com.inxar.syntacs.util
Class HashIntFunction
java.lang.Object
|
+--com.inxar.syntacs.util.HashIntFunction
- All Implemented Interfaces:
- IntFunction
- public class HashIntFunction
- extends Object
- implements IntFunction
Concrete implementation of IntFunction
which uses a
hash table to maintain the association between key and value.
Constructor Summary |
HashIntFunction()
Constructs the HashIntFunction with a default
initial capacity. |
HashIntFunction(int capacity)
Constructs the HashIntFunction with the given
initial capacity. |
Method Summary |
int |
get(int x)
Returns the value mapped to the given key. |
IntSet |
keys()
Returns an IntSet view of the keys. |
void |
put(int x,
int value)
Sets the given value to the given key. |
int |
size()
|
String |
toString()
|
HashIntFunction
public HashIntFunction()
- Constructs the
HashIntFunction
with a default
initial capacity.
HashIntFunction
public HashIntFunction(int capacity)
- Constructs the
HashIntFunction
with the given
initial capacity.
get
public int get(int x)
- Description copied from interface:
IntFunction
- Returns the value mapped to the given key.
- Specified by:
get
in interface IntFunction
put
public void put(int x,
int value)
- Description copied from interface:
IntFunction
- Sets the given value to the given key.
- Specified by:
put
in interface IntFunction
size
public int size()
keys
public IntSet keys()
- Description copied from interface:
IntFunction
- Returns an
IntSet
view of the keys.
- Specified by:
keys
in interface IntFunction
toString
public String toString()
- Overrides:
toString
in class Object