Package com.pnfsoftware.jeb.util.collect
Class SynchronizedIdentityMap<K,V>
java.lang.Object
com.pnfsoftware.jeb.util.collect.SynchronizedIdentityMap<K,V>
- Type Parameters:
K- key typeV- value type
A serializable, inefficient, fully synchronized, identity pseudo-map.
See SynchronizedLinkedMap for details and caveats.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Remove all mappings.booleancontainsKey(K key) booleancontainsValue(V value) Copy the current keys.firstKey()booleanisEmpty()Add or replace a mapping.Remove a mapping.intsize()toString()
-
Constructor Details
-
SynchronizedIdentityMap
public SynchronizedIdentityMap()Create an empty synchronized identity map.
-
-
Method Details
-
size
public int size()- Returns:
- number of mappings
-
clear
public void clear()Remove all mappings. -
isEmpty
public boolean isEmpty()- Returns:
- true if no mapping exists
-
containsKey
- Parameters:
key- key- Returns:
- true if the key is present
-
containsValue
- Parameters:
value- value- Returns:
- true if the value is present
-
get
- Parameters:
key- key- Returns:
- value associated with the key, or null
-
put
Add or replace a mapping.- Parameters:
key- non-null keyvalue- non-null value- Returns:
- previous value, or null
-
remove
Remove a mapping.- Parameters:
key- key- Returns:
- removed value, or null
-
copyOfKeys
Copy the current keys.- Returns:
- copy of the key set
-
firstKey
- Returns:
- first key in iteration order
- Throws:
NoSuchElementException- if the map is empty
-
toString
-