public class IdentityComparator<T> extends Object implements Comparator<T>
This is useful if dynamic proxy is used with TreeSet or TreeMap (so equals is expensive). Reason: the speed of identifyHashCode is much faster than dynamic proxy (150:1).
However, if possible, java.util.IdentityHashMap and IdentityHashSet
are preferred.
IdentityHashSet| Constructor and Description |
|---|
IdentityComparator() |
| Modifier and Type | Method and Description |
|---|---|
int |
compare(T o1,
T o2) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcomparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLongpublic int compare(T o1, T o2)
compare in interface Comparator<T>Copyright © 2018. All rights reserved.