T - The type of object to compare.public class EquivalenceComparator<T>
extends java.lang.Object
implements java.util.Comparator<T>
EquivalenceComparator, but not necessarily between different
instances of EquivalenceComparator.| Modifier and Type | Class and Description |
|---|---|
protected class |
EquivalenceComparator.IDReference |
| Constructor and Description |
|---|
EquivalenceComparator(java.util.function.BiPredicate<? super T,? super T> equality)
Create a fresh identity comparator.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clean()
This method can be called to prune stale references from the hash-collision
map.
|
int |
compare(T first,
T second) |
static <T> EquivalenceComparator<T> |
identityComparator()
Create a new
EquivalenceComparator over the identity operation. |
static <T> EquivalenceComparator<T> |
naturalComparator()
Create a new
EquivalenceComparator over the Object.equals(java.lang.Object)
equality operation. |
public static <T> EquivalenceComparator<T> identityComparator()
EquivalenceComparator over the identity operation.T - The type of the items to comparepublic static <T> EquivalenceComparator<T> naturalComparator()
EquivalenceComparator over the Object.equals(java.lang.Object)
equality operation.T - The type of the items to comparepublic int compare(T first, T second)
compare in interface java.util.Comparator<T>public void clean()