Created
April 23, 2014 20:51
-
-
Save superfell/11231957 to your computer and use it in GitHub Desktop.
SObject == issue in apex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Account a1 = new Account(name = 'woop'); | |
Account a2 = new Account(name = 'woop'); | |
Account a3 = (Account)JSON.deserialize('{"name" : "woop"}', Account.class); | |
Account a4 = (Account)JSON.deserialize(JSON.serialize(a1), Account.class); | |
System.debug( a1 == a2 ); // true | |
System.debug( a1 === a2); // false | |
System.debug( a3 == a1 ); // true | |
System.debug( a4 == a1 ); // false but should be true | |
System.debug( a3 == a4 ); // false but should be true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment