Package com.google.common.graph
Class MapIteratorCache<K,V>
java.lang.Object
com.google.common.graph.MapIteratorCache<K,V>
- Direct Known Subclasses:
MapRetrievalCache
A map-like data structure that wraps a backing map and caches values while iterating through
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.
-
Field Summary
FieldsModifier and TypeFieldDescription -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) final void
clear()
(package private) void
(package private) final boolean
containsKey
(Object key) (package private) V
(package private) V
getIfCached
(Object key) (package private) final V
getWithoutCaching
(Object key) (package private) final V
(package private) final V
-
Field Details
-
backingMap
-
cacheEntry
-
-
Constructor Details
-
MapIteratorCache
-
-
Method Details
-
put
-
remove
-
clear
final void clear() -
get
-
getWithoutCaching
-
containsKey
-
unmodifiableKeySet
-
getIfCached
-
clearCache
void clearCache()
-