Package com.pnfsoftware.jeb.util.collect
Class IntMap
java.lang.Object
com.pnfsoftware.jeb.util.collect.IntMap
A memory-efficient map (dictionary) of
int
primitives to int
primitives.
Additions, retrieval, updates are supported. Deletes are not supported.
All ints are valid keys and values. The value 0, however, may indicate an empty entry.
Note: Object.hashCode()
and Object.equals(Object)
are not overridden.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
IntMap
public IntMap()
-
-
Method Details
-
size
public int size() -
isEmpty
public boolean isEmpty() -
clear
public void clear() -
put
public int put(int key, int val) Add an entry.- Parameters:
key
-val
-- Returns:
- the previous value (0 if there was none associated with the key)
-
get
public int get(int key) Retrieve a value associated to a key.- Parameters:
key
-- Returns:
- the value; 0 may indicate that the entry was not present in the map
-
containsKey
public boolean containsKey(int key) Determine if the key maps to an entry in the map.- Parameters:
key
-- Returns:
-
toString
-