public class CacheMap extends Object implements Map
Map, except that you can store
only a limited number of entries. After adding an entry that exceeds the size of the
cache, the map ejects the least recently used entry.| Constructor and Description |
|---|
CacheMap()
Create a cache map with a default capacity of 5 entries.
|
CacheMap(int capacity)
Create a cache map with the given capacity.
|
CacheMap(Map map)
Create a cache map from the given map, having the capacity of the given map.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
boolean |
containsKey(Object key)
Returns true if there's a mapping for the specified key in the cache map.
|
boolean |
containsValue(Object value)
Returns true if there's a mapping for the specified value in the cache map.
|
Set |
entrySet() |
boolean |
equals(Object rhs) |
Object |
get(Object key) |
int |
getCapacity()
Get the cache map's capacity.
|
int |
hashCode() |
boolean |
isEmpty() |
Set |
keySet() |
Object |
put(Object key,
Object value) |
void |
putAll(Map t) |
Object |
remove(Object key) |
int |
size() |
Collection |
values() |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitcompute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAllpublic CacheMap()
public CacheMap(int capacity)
capacity - How big the cache is.public CacheMap(Map map)
map - The map to copy.public int getCapacity()
public boolean containsKey(Object key)
containsKey in interface Mapkey - Key to check.public boolean containsValue(Object value)
containsValue in interface Mapvalue - Value to check.public Collection values()
public boolean equals(Object rhs)
Copyright © 1999–2017 Apache OODT. All rights reserved.