Created
August 28, 2012 01:08
-
-
Save mailtoharshit/3494041 to your computer and use it in GitHub Desktop.
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
The equals method with this signature: | |
public Boolean equals(Object obj) { | |
// Your implementation | |
} | |
Keep in mind the following when implementing the equals method. Assuming x, y, and z are non-null instances of your | |
class, the equals method must be: | |
◊ Reflexive: x.equals(x) | |
◊ Symmetric: x.equals(y) should return true if and only if y.equals(x) returns true | |
◊ Transitive: if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true | |
◊ Consistent: multiple invocations of x.equals(y) consistently return true or consistently return false | |
◊ For any non-null reference value x, x.equals(null) should return false | |
The equals method in Apex is based on the equals method in Java. | |
The hashCode method with this signature: | |
public Integer hashCode() { | |
// Your implementation | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment