Java: How to workaround the lack of Equatable interface?
- by java.is.for.desktop
Hello, everyone!
As far as I know, things such as SortedMap or SortedSet, use compareTo (rather than equals) on Comparable<?> types for checking equality (contains, containsKey).
But what if certain types are equatable by concept, but not comparable?
I have to declare a Comparator<?> and override the method int compareTo(T o1, To2).…