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()Create an empty integer map.
-
-
Method Details
-
size
public int size()- Returns:
- number of entries in the map
-
isEmpty
public boolean isEmpty()- Returns:
- true if the map has no entries
-
clear
public void clear()Remove all entries. -
put
public int put(int key, int val) Add an entry.- Parameters:
key- keyval- value- 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- 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- key- Returns:
- true if the key is present
-
toString
-