Package com.google.common.graph
Class MapRetrievalCache<K,V>
- java.lang.Object
-
- com.google.common.graph.MapIteratorCache<K,V>
-
- com.google.common.graph.MapRetrievalCache<K,V>
-
class MapRetrievalCache<K,V> extends MapIteratorCache<K,V>
AMapIteratorCache
that adds additional caching. In addition to the caching provided byMapIteratorCache
, this structure caches values for the two most recently retrieved keys.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
MapRetrievalCache.CacheEntry<K,V>
-
Field Summary
Fields Modifier and Type Field Description private MapRetrievalCache.CacheEntry<K,V>
cacheEntry1
private MapRetrievalCache.CacheEntry<K,V>
cacheEntry2
-
Constructor Summary
Constructors Constructor Description MapRetrievalCache(java.util.Map<K,V> backingMap)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
addToCache(MapRetrievalCache.CacheEntry<K,V> entry)
private void
addToCache(K key, V value)
protected void
clearCache()
V
get(java.lang.Object key)
protected V
getIfCached(java.lang.Object key)
-
Methods inherited from class com.google.common.graph.MapIteratorCache
clear, containsKey, getWithoutCaching, put, remove, unmodifiableKeySet
-
-
-
-
Field Detail
-
cacheEntry1
@Nullable private transient MapRetrievalCache.CacheEntry<K,V> cacheEntry1
-
cacheEntry2
@Nullable private transient MapRetrievalCache.CacheEntry<K,V> cacheEntry2
-
-
Method Detail
-
get
public V get(@Nullable java.lang.Object key)
- Overrides:
get
in classMapIteratorCache<K,V>
-
getIfCached
protected V getIfCached(@Nullable java.lang.Object key)
- Overrides:
getIfCached
in classMapIteratorCache<K,V>
-
clearCache
protected void clearCache()
- Overrides:
clearCache
in classMapIteratorCache<K,V>
-
addToCache
private void addToCache(MapRetrievalCache.CacheEntry<K,V> entry)
-
-