- java.lang.Object
-
- com.ibm.j9ddr.corereaders.tdump.zebedee.util.AbstractHashMap
-
- com.ibm.j9ddr.corereaders.tdump.zebedee.util.AbstractLruCache
-
- com.ibm.j9ddr.corereaders.tdump.zebedee.util.IntegerLruCache
-
- All Implemented Interfaces:
Serializable
public final class IntegerLruCache extends AbstractLruCache
This class provides an LRU (Least Recently Used) cache which maps integer keys to int values. See the description in the superclassAbstractLruCache
for more details. Like its siblingIntegerMap
it is low footprint. Note that the value -1 is not allowed (see discussion inIntegerMap
).- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description IntegerLruCache(int maxSize)
Create a new IntegerLruCache.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
get(long key)
Returns the value mapped by the given key.static void
main(String[] args)
Run some basic tests on this class.void
put(long key, int value)
Add the key/value pair to the map.-
Methods declared in class com.ibm.j9ddr.corereaders.tdump.zebedee.util.AbstractLruCache
getIndexAndPromote, putIndexAndPromote
-
Methods declared in class com.ibm.j9ddr.corereaders.tdump.zebedee.util.AbstractHashMap
getKeys, getKeysArray, size
-
-
-
-
Method Detail
-
get
public int get(long key)
Returns the value mapped by the given key. Also promotes this key to the most recently used.- Returns:
- the value or -1 if it cannot be found
-
put
public void put(long key, int value)
Add the key/value pair to the map. The value must not be -1.
-
main
public static void main(String[] args)
Run some basic tests on this class.
-
-