class MapIteratorCache<K,V>
extends java.lang.Object
unmodifiableKeySet()
. By design, the cache is cleared when this structure is mutated. If
this structure is never mutated, it provides a thread-safe view of the backing map.
The MapIteratorCache
assumes ownership of the backing map, and cannot guarantee
correctness in the face of external mutations to the backing map. As such, it is strongly
recommended that the caller does not persist a reference to the backing map (unless the backing
map is immutable).
This class is tailored toward use cases in common.graph. It is *NOT* a general purpose map.
Modifier and Type | Field and Description |
---|---|
private java.util.Map<K,V> |
backingMap |
private java.util.Map.Entry<K,V> |
cacheEntry |
Constructor and Description |
---|
MapIteratorCache(java.util.Map<K,V> backingMap) |
Modifier and Type | Method and Description |
---|---|
(package private) void |
clear() |
(package private) void |
clearCache() |
(package private) boolean |
containsKey(java.lang.Object key) |
(package private) V |
get(java.lang.Object key) |
(package private) V |
getIfCached(java.lang.Object key) |
(package private) V |
getWithoutCaching(java.lang.Object key) |
(package private) V |
put(K key,
V value) |
(package private) V |
remove(java.lang.Object key) |
(package private) java.util.Set<K> |
unmodifiableKeySet() |
@CheckForNull final V remove(java.lang.Object key)
final void clear()
@CheckForNull V get(java.lang.Object key)
@CheckForNull final V getWithoutCaching(java.lang.Object key)
final boolean containsKey(@CheckForNull java.lang.Object key)
final java.util.Set<K> unmodifiableKeySet()
@CheckForNull V getIfCached(@CheckForNull java.lang.Object key)
void clearCache()