Package io.permazen.core.util
Class ObjIdMap<V>
- All Implemented Interfaces:
Serializable
,Cloneable
,Map<ObjId,
V>
@NotThreadSafe
public class ObjIdMap<V>
extends AbstractMap<ObjId,V>
implements Cloneable, Serializable
A map with
ObjId
keys.
This implementation is space optimized for the 64-bits of information contained in an ObjId
.
Instances do not accept null keys and are not thread safe.
Instances are Serializable
if the map values.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,
V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
Constructor Summary
-
Method Summary
Methods inherited from class java.util.AbstractMap
containsValue, equals, putAll, toString, values
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Constructor Details
-
ObjIdMap
public ObjIdMap()Constructs an empty instance. -
ObjIdMap
public ObjIdMap(int capacity) Constructs an instance with the given initial capacity.- Parameters:
capacity
- initial capacity- Throws:
IllegalArgumentException
- ifcapacity
is negative
-
ObjIdMap
Constructs an instance initialized from the given map.- Parameters:
map
- initial contents for this instance- Throws:
NullPointerException
- ifmap
is nullIllegalArgumentException
- ifmap
contains a null key
-
-
Method Details
-
size
public int size() -
isEmpty
public boolean isEmpty() -
containsKey
- Specified by:
containsKey
in interfaceMap<ObjId,
V> - Overrides:
containsKey
in classAbstractMap<ObjId,
V>
-
get
-
put
-
remove
-
clear
public void clear() -
keySet
-
entrySet
-
removeOne
Remove a single, arbitrary entry from this instance and return it.- Returns:
- the removed entry, or null if this instance is empty
-
hashCode
public int hashCode() -
clone
- Overrides:
clone
in classAbstractMap<ObjId,
V>
-