public class HashableCoreMap extends ArrayCoreMap
ArrayCoreMap
with an immutable set of key,value
pairs that is used for equality and hashcode comparisons.Modifier and Type | Class and Description |
---|---|
static class |
HashableCoreMap.HashableCoreMapException
An exception thrown when attempting to change the value associated
with an (immutable) hash key in a HashableCoreMap.
|
TypesafeMap.Key<VALUE>
listener
Constructor and Description |
---|
HashableCoreMap(ArrayCoreMap other,
java.util.Set<java.lang.Class<? extends TypesafeMap.Key<?>>> hashkey)
Creates an instance by copying values from the given other CoreMap,
using the values it associates with the given set of hashkeys for
the immutable, hashable keys used by hashcode and equals.
|
HashableCoreMap(java.util.Map<java.lang.Class<? extends TypesafeMap.Key<?>>,java.lang.Object> hashkey)
Creates an instance of HashableCoreMap with initial key,value pairs
for the immutable, hashable keys as provided in the given map.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o)
If the provided object is a HashableCoreMap, equality is based only
upon the values of the immutable hashkeys; otherwise, defaults to
behavior of the superclass's equals method.
|
int |
hashCode()
Provides a hash code based on the immutable keys and values provided
to the constructor.
|
<VALUE> VALUE |
set(java.lang.Class<? extends TypesafeMap.Key<VALUE>> key,
VALUE value)
Sets the value associated with the given key; if the the key is one
of the hashable keys, throws an exception.
|
compact, containsKey, get, keySet, keySetNotNull, prettyLog, remove, setCapacity, size, toShorterString, toShortString, toShortString, toString
public HashableCoreMap(java.util.Map<java.lang.Class<? extends TypesafeMap.Key<?>>,java.lang.Object> hashkey)
public HashableCoreMap(ArrayCoreMap other, java.util.Set<java.lang.Class<? extends TypesafeMap.Key<?>>> hashkey)
public <VALUE> VALUE set(java.lang.Class<? extends TypesafeMap.Key<VALUE>> key, VALUE value)
set
in interface TypesafeMap
set
in class ArrayCoreMap
HashableCoreMap.HashableCoreMapException
- Attempting to set the value for an
immutable, hashable key.public int hashCode()
hashCode
in class ArrayCoreMap
public boolean equals(java.lang.Object o)
equals
in class ArrayCoreMap