|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.devexperts.util.Indexer<K,V>
com.devexperts.util.IdentityIndexer<K,V>
public abstract class IdentityIndexer<K,V>
A subclass of Indexer
that distinguishes and identifies elements using identity comparison of object keys.
It uses System.identityHashCode(Object)
method instead of
Object.hashCode()
method to compute hashcode and reference comparison
instead of Object.equals(Object)
method to determine identity.
The IdentityIndexer itself is not serializable. However, concrete subclasses shall be serializable in order to support serialization of indexed set and map.
Field Summary |
---|
Fields inherited from class com.devexperts.util.Indexer |
---|
DEFAULT |
Constructor Summary | |
---|---|
protected |
IdentityIndexer()
Sole constructor; for invocation by subclass constructors, typically implicit. |
Method Summary | |
---|---|
int |
hashCodeByKey(K key)
Returns hash code for specified object key; called when performing operations using object keys. |
int |
hashCodeByValue(V value)
Returns hash code for specified value; called when performing value-based operations, including rehash. |
boolean |
matchesByKey(K key,
V value)
Determines if specified object key matches specified value; called when performing operations using object keys. |
boolean |
matchesByValue(V new_value,
V old_value)
Determines if specified new value matches specified old value; called when performing value-based operations. |
Methods inherited from class com.devexperts.util.Indexer |
---|
getNumberKey, getObjectKey, hashCodeByKey, matchesByKey |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected IdentityIndexer()
This implementation does nothing.
Method Detail |
---|
public int hashCodeByValue(V value)
This implementation delegates to System.identityHashCode(
getObjectKey(value))
expression.
hashCodeByValue
in class Indexer<K,V>
public boolean matchesByValue(V new_value, V old_value)
This implementation delegates to (getObjectKey(new_value)
== getObjectKey(old_value)
) expression.
matchesByValue
in class Indexer<K,V>
public int hashCodeByKey(K key)
This implementation delegates to System.identityHashCode(key)
expression.
hashCodeByKey
in class Indexer<K,V>
UnsupportedOperationException
- if this strategy does not support object keys.public boolean matchesByKey(K key, V value)
This implementation delegates to (key == getObjectKey(value)
) expression.
matchesByKey
in class Indexer<K,V>
UnsupportedOperationException
- if this strategy does not support object keys.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |