public final class IntHashMap<T> extends Object
A hash map that uses primitive ints for the key rather than objects.
Note that this class is for internal optimization purposes only, and may not be supported in future releases of Apache Commons Lang. Utilities of this sort may be included in future releases of Apache Commons Collections.
HashMap| Constructor and Description |
|---|
IntHashMap()
Constructs a new, empty hashtable with a default capacity and load
factor, which is
20 and 0.75 respectively. |
IntHashMap(int initialCapacity)
Constructs a new, empty hashtable with the specified initial capacity
and default load factor, which is
0.75. |
IntHashMap(int initialCapacity,
float loadFactor)
Constructs a new, empty hashtable with the specified initial
capacity and the specified load factor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clears this Map so that it contains no keys.
|
boolean |
containsKey(int key)
Tests if the specified object is a key in this hashtable.
|
boolean |
containsValue(T value)
Tests if some key maps into the specified value in this hashtable.
|
T |
get(int key)
Returns the value to which the specified key is mapped in this map.
|
boolean |
isEmpty()
Tests if this hashtable maps no keys to values.
|
T |
put(int key,
T value)
Maps the specified
key to the specified
value in this hashtable. |
protected void |
rehash()
Increases the capacity of and internally reorganizes this
hashtable, in order to accommodate and access its entries more
efficiently.
|
T |
remove(int key)
Removes the key (and its corresponding value) from this
map.
|
int |
size()
Returns the number of keys in this hashtable.
|
public IntHashMap()
Constructs a new, empty hashtable with a default capacity and load
factor, which is 20 and 0.75 respectively.
public IntHashMap(int initialCapacity)
Constructs a new, empty hashtable with the specified initial capacity
and default load factor, which is 0.75.
initialCapacity - the initial capacity of the hashtable.IllegalArgumentException - if the initial capacity is less
than zero.public IntHashMap(int initialCapacity,
float loadFactor)
Constructs a new, empty hashtable with the specified initial capacity and the specified load factor.
initialCapacity - the initial capacity of the hashtable.loadFactor - the load factor of the hashtable.IllegalArgumentException - if the initial capacity is less
than zero, or if the load factor is nonpositive.public int size()
public boolean isEmpty()
public boolean containsValue(T value)
containsKey
method.public boolean containsKey(int key)
@Nullable public T get(int key)
protected void rehash()
@Nullable public T put(int key, T value)
key to the specified
value in this hashtable. The key cannot be
null@Nullable public T remove(int key)
public void clear()
Copyright © 2017 etc.to. All rights reserved.