Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- contact c1 = new contact(id='003000000089012', firstname='1', lastname='2', phone=null);
- contact c2 = new contact(id='003000000089012', firstname='1', lastname='2');
- contact c3 = new contact(id='003000000089012', firstname='1', lastname='2', phone='');
- contact c4 = new contact(id='003000000089012', firstname='1', lastname='3', phone='');
- contact c5 = new contact(id='003000000089012', firstname='1', lastname='3');
- set<contact> contacts = new set<contact>();
- contacts.add(c1);
- contacts.add(c2);
- contacts.add(c3);
- contacts.add(c4);
- contacts.add(c5);
- for(contact c : contacts){
- system.debug('5 Items: '+c);
- }
- system.debug('5 Items BREAK');
- c1.phone='';
- for(contact c : contacts){
- system.debug('Same : '+c);
- }
- system.debug('Same BREAK');
- contacts.add(c1);
- for(contact c : contacts){
- system.debug('c1 Added: '+c);
- }
- system.debug('c1 Added BREAK');
- contact c6 = new contact(id='003000000089012', firstname='1', lastname='2', phone='');
- contacts.add(c6);
- for(contact c : contacts){
- system.debug('New Same: '+c);
- }
- system.debug('New Same BREAK');
- contacts.addall(contacts);
- for(contact c : contacts){
- system.debug('Addall: '+c);
- }
- system.debug('Addall BREAK');
- set<contact> cnts2 = new set<contact>();
- cnts2 = contacts.clone();
- for(contact c : cnts2){
- system.debug('Clone: '+c);
- }
- system.debug('Clone BREAK');
- set<contact> cnts3 = new set<contact>();
- cnts3.addall(contacts);
- for(contact c : cnts3){
- system.debug('New Addall: '+c);
- }
- system.debug('New Addall BREAK');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement