public interface Equivalence<T> extends Serializable
Comparable
rules, but where the behaviour provided by the JDK, or
external libraries, cannot be modified, for example: arrays.
The interface is marked to be Serializable
because multiple
collection extensions within the Infinispan code base contain references
to them, and since these are potentially Serializable
, they might
be persisted somehow.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.
|
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.
|
int hashCode(Object obj)
Object.hashCode()
, call java.util.Arrays.hashCode()
.obj
- instance to calculate hash code forboolean equals(T obj, Object otherObj)
Object.equals(Object)
}, call java.util.Arrays.equals())
.obj
- to be compared with second parameterotherObj
- to be compared with first parametertrue
if both objects are the same;
false
otherwiseString toString(Object obj)
obj
- whose string representation is to be returnedboolean isComparable(Object obj)
compare(Object, Object)
method.obj
- instance to check if it's comparabletrue
if the object is comparable;
false
otherwiseint compare(T obj, T otherObj)
obj
- first object to be comparedotherObj
- second object to be comparedCopyright © 2018 JBoss, a division of Red Hat. All rights reserved.