More specifically I want an interface to compare objects which can be only compared for equality [e.g. complex numbers] but don\'t have total order on them. It should have [Not
The type you want is Guava's Equivalence. However, you may be disappointed, as in Java Collection
and Map
are fairly rigidly specified in terms of Object.equals
, and you will not find implementations of those in Guava that use an alternate equivalence. You can, however, simulate that behavior a bit using myEquivalence.wrap(myObject)
.