public final class AnyEquivalence<T> extends Object implements Equivalence<T>
| Modifier and Type | Field and Description |
|---|---|
static AnyEquivalence<Boolean> |
BOOLEAN |
static AnyEquivalence<Byte> |
BYTE |
static AnyEquivalence<Double> |
DOUBLE |
static AnyEquivalence<Float> |
FLOAT |
static AnyEquivalence<Integer> |
INT |
static AnyEquivalence<Long> |
LONG |
static AnyEquivalence<Short> |
SHORT |
static AnyEquivalence<String> |
STRING |
| Modifier and Type | Method and Description |
|---|---|
int |
compare(T obj,
T otherObj)
Compares the two given objects for order.
|
boolean |
equals(T obj,
Object otherObj)
Indicates whether the objects passed are "equal to" each other.
|
static <T> AnyEquivalence<T> |
getInstance() |
int |
hashCode(Object obj)
Returns a hash code value for the object passed.
|
boolean |
isComparable(Object obj)
Returns whether the given object is comparable.
|
String |
toString(Object obj)
Returns a string representation of the given object.
|
public static AnyEquivalence<String> STRING
public static AnyEquivalence<Byte> BYTE
public static AnyEquivalence<Short> SHORT
public static AnyEquivalence<Integer> INT
public static AnyEquivalence<Long> LONG
public static AnyEquivalence<Double> DOUBLE
public static AnyEquivalence<Float> FLOAT
public static AnyEquivalence<Boolean> BOOLEAN
public int hashCode(Object obj)
EquivalenceObject.hashCode(), call java.util.Arrays.hashCode().hashCode in interface Equivalence<T>obj - instance to calculate hash code forpublic boolean equals(T obj, Object otherObj)
EquivalenceObject.equals(Object)}, call java.util.Arrays.equals()).equals in interface Equivalence<T>obj - to be compared with second parameterotherObj - to be compared with first parametertrue if both objects are the same;
false otherwisepublic String toString(Object obj)
EquivalencetoString in interface Equivalence<T>obj - whose string representation is to be returnedpublic boolean isComparable(Object obj)
EquivalenceEquivalence.compare(Object, Object) method.isComparable in interface Equivalence<T>obj - instance to check if it's comparabletrue if the object is comparable;
false otherwisepublic int compare(T obj, T otherObj)
Equivalencecompare in interface Equivalence<T>obj - first object to be comparedotherObj - second object to be comparedpublic static <T> AnyEquivalence<T> getInstance()
Copyright © 2014 JBoss, a division of Red Hat. All Rights Reserved.