Guava's Equivalence: strategy for equals()/hashCode()

Introduction Given a class C, if you want to implement ordering, you have two choices: Have your class implement Comparable<c> (or Comparable<x>, where X is a superclass of C). Define a Comparator<c> to use with this class (or a Comparator<x>, where X is a superclass of C). In fact, many classes in the JDK will have you supply a Comparator if your class...

4 minute(s) read