Class EvictingMap<K,V>
java.lang.Object
de.florianmichael.rclasses.pattern.evicting.EvictingMap<K,V>
- Type Parameters:
K- The type of the key.V- The type of the value.
Implementation of an evicting map. This map will remove the first entry if the map is full.
-
Constructor Summary
ConstructorsConstructorDescriptionDummy constructor.EvictingMap(Map<K, V> map, int maxSize) Creates a new evicting map. -
Method Summary
Modifier and TypeMethodDescriptionintbooleanisFull()booleanPuts a key and a value into the map.
-
Constructor Details
-
EvictingMap
public EvictingMap()Dummy constructor. -
EvictingMap
Creates a new evicting map.- Parameters:
map- The map.maxSize- The maximum size of the map.
-
-
Method Details
-
put
Puts a key and a value into the map. If the map is full, the first entry will be removed. Returns true if the map was full.- Parameters:
key- The key.value- The value.- Returns:
- True if the map was full.
-
isFull
public boolean isFull()- Returns:
- True if the map is full.
-
getNormalMap
-
getMaxSize
public int getMaxSize()
-