IEqualityComparer interface in Java
问题 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 [Note that it only returns a boolean yes/no] boolean Equals(T object1, T object2); and a hashcode function. So that when I distribute them into buckets using objects say to collect "equal" objects, 2 "equal" objects don't end up in two different buckets. int getHashCode(T object); Does Java have one? I searched and couldn't