Interface Equivalence<T>
-
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
AnyEquivalence,AnyServerEquivalence,ByteArrayEquivalence,IdentityEquivalence
@Deprecated public interface Equivalence<T> extends Serializable
Deprecated.An interface that allows custom implementations for objects that are comparable based on equality, hash code calculations, or according toComparablerules, but where the behaviour provided by the JDK, or external libraries, cannot be modified, for example: arrays. The interface is marked to beSerializablebecause multiple collection extensions within the Infinispan code base contain references to them, and since these are potentiallySerializable, they might be persisted somehow.- Since:
- 5.3
- Author:
- Galder ZamarreƱo
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description intcompare(T obj, T otherObj)Deprecated.Compares the two given objects for order.booleanequals(T obj, Object otherObj)Deprecated.Indicates whether the objects passed are "equal to" each other.inthashCode(Object obj)Deprecated.Returns a hash code value for the object passed.booleanisComparable(Object obj)Deprecated.Returns whether the given object is comparable.StringtoString(Object obj)Deprecated.Returns a string representation of the given object.
-
-
-
Method Detail
-
hashCode
int hashCode(Object obj)
Deprecated.Returns a hash code value for the object passed. As an example, implementors can provide an alternative implementation for the hash code calculation for arrays. So, instead of relying onObject.hashCode(), callObject.hashCode().- Parameters:
obj- instance to calculate hash code for- Returns:
- a hash code value for the object passed as parameter
-
equals
boolean equals(T obj, Object otherObj)
Deprecated.Indicates whether the objects passed are "equal to" each other. As an example, implementors can provide an alternative implementation for the equals for arrays. So, instead of relying onObject.equals(Object)}, callArrays.equals(Object[], Object[]).- Parameters:
obj- to be compared with second parameterotherObj- to be compared with first parameter- Returns:
trueif both objects are the same;falseotherwise
-
toString
String toString(Object obj)
Deprecated.Returns a string representation of the given object.- Parameters:
obj- whose string representation is to be returned- Returns:
- a string representation of the passed object
-
isComparable
boolean isComparable(Object obj)
Deprecated.Returns whether the given object is comparable. In other words, if given an instance of the object, a sensible comparison can be computed usingcompare(Object, Object)method.- Parameters:
obj- instance to check if it's comparable- Returns:
trueif the object is comparable;falseotherwise
-
compare
int compare(T obj, T otherObj)
Deprecated.Compares the two given objects for order. Returns a negative integer, zero, or a positive integer as the first object is less than, equal to, or greater than the second object.- Parameters:
obj- first object to be comparedotherObj- second object to be compared- Returns:
- a negative integer, zero, or a positive integer as the first object is less than, equal to, or greater than the second object
-
-