IndexerFunction.LongKey
or IndexerFunction.IntKey
instead.@Deprecated public abstract class NumberKeyIndexer<V> extends Indexer<Long,V> implements IndexerFunction.LongKey<V>
Indexer
that distinguishes and identifies elements using number keys.
It assumes that elements are fully identifiable by numeric ID and treats object keys as a mere wrappers. The hash function is computed using (int) (key ^ (key >>> 32)) formula.
The NumberKeyIndexer is Serializable
, so that all concrete subclasses
shall be serializable in order to support serialization of indexed set and map..
IndexerFunction.DefaultIdentityKey, IndexerFunction.DefaultIndexerFunction, IndexerFunction.IdentityKey<K,V>, IndexerFunction.IntKey<V>, IndexerFunction.LongKey<V>
DEFAULT, DEFAULT_IDENTITY_KEY
Modifier | Constructor and Description |
---|---|
protected |
NumberKeyIndexer()
Deprecated.
Sole constructor; for invocation by subclass constructors, typically implicit.
|
Modifier and Type | Method and Description |
---|---|
abstract long |
getNumberKey(V value)
Deprecated.
Returns number key for specified value to be used for hashing and identification;
called when explicit number key is needed or when other methods delegate operations as specified.
|
Long |
getObjectKey(V value)
Deprecated.
Returns object key for specified value to be used for hashing and identification;
called when explicit object key is needed or when other methods delegate operations as specified.
|
int |
hashCodeByKey(Long key)
Deprecated.
Returns hash code for specified object key; called when performing operations using object keys.
|
int |
hashCodeByValue(V value)
Deprecated.
Returns hash code for specified value; called when performing value-based operations, including rehash.
|
boolean |
matchesByKey(Long key,
V value)
Deprecated.
Determines if specified object key matches specified value; called when performing operations using object keys.
|
boolean |
matchesByValue(V newValue,
V oldValue)
Deprecated.
Determines if specified new value matches specified old value; called when performing value-based operations.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
hashCodeByKey, matchesByKey
protected NumberKeyIndexer()
This implementation does nothing.
public int hashCodeByValue(V value)
This implementation computes hash function of
hashCodeByKey(getNumberKey(value))
expression.
hashCodeByValue
in interface IndexerFunction<Long,V>
hashCodeByValue
in interface IndexerFunction.LongKey<V>
public boolean matchesByValue(V newValue, V oldValue)
This implementation delegates to (
expression.getNumberKey
(newValue) == getNumberKey
(oldValue))
matchesByValue
in interface IndexerFunction<Long,V>
matchesByValue
in interface IndexerFunction.LongKey<V>
public Long getObjectKey(V value)
This implementation delegates to Long.
expression.valueOf
(getNumberKey
(value))
getObjectKey
in interface IndexerFunction<Long,V>
getObjectKey
in interface IndexerFunction.LongKey<V>
public int hashCodeByKey(Long key)
This implementation computes hash function of
hashCodeByKey(key.intValue())
expression.
hashCodeByKey
in interface IndexerFunction<Long,V>
hashCodeByKey
in interface IndexerFunction.LongKey<V>
public boolean matchesByKey(Long key, V value)
This implementation delegates to (key.
expression.longValue
() == getNumberKey
(value))
matchesByKey
in interface IndexerFunction<Long,V>
matchesByKey
in interface IndexerFunction.LongKey<V>
public abstract long getNumberKey(V value)
getNumberKey
in interface IndexerFunction<Long,V>
getNumberKey
in interface IndexerFunction.LongKey<V>
Copyright © 2002–2025 Devexperts LLC. All rights reserved.