daily pastebin goal


a guest Dec 13th, 2018 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @Java
  3. When you override the equals method, you must adhere to its general contract. Here
  4. is the contract, copied from the specification for java.lang.Object:
  6. The equals method implements an equivalence relation:
  8. • It is reflexive: For any reference value x, x.equals(x) must return true.
  9. • It is symmetric: For any reference values x and y, x.equals(y) must return true
  10. if and only if y.equals(x) returns true.
  11. • It is transitive: For any reference values x, y, and z, if x.equals(y)
  12. returns true and y.equals(z) returns true, then x.equals(z) must return true.
  13. • It is consistent: For any reference values x and y, multiple invocations
  14. of x.equals(y) consistently return true or consistently return false, provided
  15. no information used in equals comparisons on the object is modified.
  16. • For any non-null reference value x, x.equals(null) must return false.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand