K - Dictionary key typeV - Dictionary value typepublic class TailIdentityHashMap<K,V> extends java.util.IdentityHashMap<K,V> implements TailMapInternal<K,V>
| Modifier and Type | Field and Description |
|---|---|
private boolean |
iteratingActive
Flag iterating state
|
private java.lang.AutoCloseable |
iteratingActiveSegment
Prevents nested use of IteratingActive
|
private static long |
serialVersionUID
Generated version UID
|
private java.util.Map<K,V> |
tailingMap
If
iteratingActive is true, new items
are added to tailingMap, since adding while iterating is
prohibited. |
| Constructor and Description |
|---|
TailIdentityHashMap()
Default constructor.
|
TailIdentityHashMap(int expectedMaxSize)
Constructor with expected maximum size.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.AutoCloseable |
flagIterating()
The caller is responsible for setting the iterating active flag, by
implementing a
try(AutoCloseable obj = dict.flagIterating())
block. |
private java.util.Map<K,V> |
getOrCreateTailingMap()
Get the tail map.
|
boolean |
isIteratingActive()
Reports if this dictionary has the "being iterated" flag.
|
java.util.Map<K,V> |
pop()
Do a 'pop' of the single tail dictionary.
|
V |
put(K key,
V value)
Add or replace a key value pair at this key.
|
void |
setIteratingActive(boolean iteratingActive)
Sets the iterating active flag
|
void |
setIteratingActiveSegment(java.lang.AutoCloseable iteratingActiveSegment)
Sets the auto-closable object, which may be set once as soon as the iterating active flag becomes true.
|
clear, clone, containsKey, containsValue, entrySet, equals, forEach, get, hashCode, isEmpty, keySet, putAll, remove, replaceAll, size, valuesfinalize, getClass, notify, notifyAll, wait, wait, waitputAtDefaultprivate static final long serialVersionUID
private boolean iteratingActive
private java.lang.AutoCloseable iteratingActiveSegment
private java.util.Map<K,V> tailingMap
iteratingActive is true, new items
are added to tailingMap, since adding while iterating is
prohibited.
Use pop() to take control of this tail dictionary.
The caller is responsible for iterating the tail.public TailIdentityHashMap()
public TailIdentityHashMap(int expectedMaxSize)
expectedMaxSize - The expected maximum size of the hash map.public java.util.Map<K,V> pop()
public boolean isIteratingActive()
isIteratingActive in interface TailMap<K,V>true if this dictionary is being iterated.public java.lang.AutoCloseable flagIterating()
try(AutoCloseable obj = dict.flagIterating())
block.flagIterating in interface TailMap<K,V>public void setIteratingActive(boolean iteratingActive)
setIteratingActive in interface TailMapInternal<K,V>iteratingActive - Iterating active true or false.public void setIteratingActiveSegment(java.lang.AutoCloseable iteratingActiveSegment)
setIteratingActiveSegment in interface TailMapInternal<K,V>iteratingActiveSegment - Pass the auto-closable object at the instant the iterating active flag becomes true.
Pass null as soon as the iterating active flag becomes false.private java.util.Map<K,V> getOrCreateTailingMap()
tailingMap.