Package gnu.trove.strategy
Class IdentityHashingStrategy<K>
java.lang.Object
gnu.trove.strategy.IdentityHashingStrategy<K>
- All Implemented Interfaces:
HashingStrategy<K>
,Serializable
A
HashingStrategy
that does identity comparisons
(==) and uses System.identityHashCode(Object)
for hashCode generation.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final IdentityHashingStrategy
<Object> A single instance that can be shared with multiple collections. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
computeHashCode
(K object) Computes a hash code for the specified object.boolean
Compares o1 and o2 for equality.
-
Field Details
-
INSTANCE
A single instance that can be shared with multiple collections. This instance is thread safe.
-
-
Constructor Details
-
IdentityHashingStrategy
public IdentityHashingStrategy()
-
-
Method Details
-
computeHashCode
Description copied from interface:HashingStrategy
Computes a hash code for the specified object. Implementers can use the object's own hashCode method, the Java runtime's identityHashCode, or a custom scheme.- Specified by:
computeHashCode
in interfaceHashingStrategy<K>
- Parameters:
object
- for which the hashcode is to be computed- Returns:
- the hashCode
-
equals
Description copied from interface:HashingStrategy
Compares o1 and o2 for equality. Strategy implementers may use the objects' own equals() methods, compare object references, or implement some custom scheme.- Specified by:
equals
in interfaceHashingStrategy<K>
- Parameters:
o1
- anObject
valueo2
- anObject
value- Returns:
- true if the objects are equal according to this strategy.
-