|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jjoost.util.Equalities
public class Equalities
Default implementations of Equality.
| Nested Class Summary | |
|---|---|
static class |
Equalities.ByteArrayEquality
an Equality over objects of type byte[], delegating to java.util.Arrays.equals(a, b)
and java.util.Arrays.hashCode(k) |
static class |
Equalities.CaseInsensitiveEquality
an Equality over String for case insensitive equality (a.equalsIgnoreCase(b));
hash() is expensive to compute as it performs toLowerCase().hashCode() |
static class |
Equalities.EntryEquality<K,V>
an Equality over objects of type Entry, for provided K and V; wraps
a separate Equality for comparing the key and value portions of the Entry. |
static class |
Equalities.IdentityEquality
an Equality for identity equality, i.e. |
static class |
Equalities.IntArrayEquality
an Equality over objects of type int[], delegating to java.util.Arrays.equals(a, b)
and java.util.Arrays.hashCode(k) |
static class |
Equalities.LongArrayEquality
an Equality over objects of type long[], delegating to java.util.Arrays.equals(a, b)
and java.util.Arrays.hashCode(k) |
static class |
Equalities.ObjectArrayEquality
an Equality over objects of type Object[], delegating to java.util.Arrays.equals(a, b)
and java.util.Arrays.hashCode(k) |
static class |
Equalities.ObjectEquality
Standard object equality, delegating to Object.equals() and Object.hashCode(), but handling nulls
gracefully |
static class |
Equalities.RehashingEquality<V>
an Equality which delegates to the provided Equality, but passes the resulting hash()
through the provided Rehasher before returning it |
| Constructor Summary | |
|---|---|
Equalities()
|
|
| Method Summary | ||
|---|---|---|
static Equality<byte[]> |
byteArray()
Returns an Equality over objects of type byte[], delegating to java.util.Arrays.equals(a, b)
and java.util.Arrays.hashCode(k) |
|
static Equality<java.lang.String> |
caseInsensitive()
Returns an Equality over String for case insensitive equality (a.equalsIgnoreCase(b));
hash() is expensive to compute as it performs toLowerCase().hashCode(), however a faster implementation
will be provided that computes an ASCII/UTF-7 only lower case hash in the near future. |
|
static
|
forMapEntries(Equality<? super K> keyEq,
Equality<? super V> valEq)
Returns an Equality over objects of type Entry, for provided K and V; wraps
a separate Equality for comparing the key and value portions of the Entry. |
|
static Equality<java.lang.Object> |
identity()
Returns an Equality for identity equality, i.e. |
|
static Equality<int[]> |
intArray()
Returns an Equality over objects of type int[], delegating to java.util.Arrays.equals(a, b)
and java.util.Arrays.hashCode(k) |
|
static Equality<long[]> |
longArray()
Returns an Equality over objects of type long[], delegating to java.util.Arrays.equals(a, b)
and java.util.Arrays.hashCode(k) |
|
static Equality<java.lang.Object> |
object()
Returns an Equality for default object equality, delegating to Object.equals() and
Object.hashCode(), but handling nulls gracefully |
|
static Equality<java.lang.Object[]> |
objectArray()
Returns an Equality over objects of type Object[], delegating to java.util.Arrays.equals(a, b)
and java.util.Arrays.hashCode(k) |
|
static
|
rehashing(Equality<V> delegate,
Rehasher rehasher)
Return an Equality which delegates to the provided Equality, but passes the resulting hash()
through the provided Rehasher before returning it |
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Equalities()
| Method Detail |
|---|
public static Equality<java.lang.Object> object()
Object.equals() and
Object.hashCode(), but handling nulls gracefully
Equalitypublic static Equality<java.lang.String> caseInsensitive()
Equality over String for case insensitive equality (a.equalsIgnoreCase(b));
hash() is expensive to compute as it performs toLowerCase().hashCode(), however a faster implementation
will be provided that computes an ASCII/UTF-7 only lower case hash in the near future.
String Equalitypublic static Equality<java.lang.Object> identity()
Equality for identity equality, i.e. like IdentityHashMap. Delegates to language equality (
a == b) and System.identityHashCode()
Equalitypublic static Equality<byte[]> byteArray()
Equality over objects of type byte[], delegating to java.util.Arrays.equals(a, b)
and java.util.Arrays.hashCode(k)
byte[] Equality public static Equality<int[]> intArray()
Equality over objects of type int[], delegating to java.util.Arrays.equals(a, b)
and java.util.Arrays.hashCode(k)
int[] Equality public static Equality<long[]> longArray()
Equality over objects of type long[], delegating to java.util.Arrays.equals(a, b)
and java.util.Arrays.hashCode(k)
long[] Equality public static Equality<java.lang.Object[]> objectArray()
Equality over objects of type Object[], delegating to java.util.Arrays.equals(a, b)
and java.util.Arrays.hashCode(k)
Object[] Equality
public static <K,V> Equality<java.util.Map.Entry<K,V>> forMapEntries(Equality<? super K> keyEq,
Equality<? super V> valEq)
Equality over objects of type Entry, for provided K and V; wraps
a separate Equality for comparing the key and value portions of the Entry.
keyEq - the Equality to use to compare the key portion of an EntryvalEq - the Equality to use to compare the value portion of an Entry
public static final <V> Equality<V> rehashing(Equality<V> delegate,
Rehasher rehasher)
Equality which delegates to the provided Equality, but passes the resulting hash()
through the provided Rehasher before returning it
delegate - the Equality to delegate torehasher - the Rehasher to pass the hash through
Equality which rehashes the hashes returned by the delegate
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||