|
LimeWire collection component api | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.limewire.collection.IntHashMap<V>
public class IntHashMap<V>
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 Jakarta Commons Lang. Utilities of this sort may be included in future releases of Jakarta Commons Collections.
HashMap,
Serialized Form| Constructor Summary | |
|---|---|
IntHashMap()
Constructs a new, empty hash table with a default capacity and load factor, which is 20 and 0.75 respectively. |
|
IntHashMap(int initialCapacity)
Constructs a new, empty hash table with the specified initial capacity and default load factor, which is 0.75. |
|
IntHashMap(int initialCapacity,
float loadFactor)
Constructs a new, empty hash table with the specified initial capacity and the specified load factor. |
|
IntHashMap(IntHashMap<? extends V> m)
Copy constructor. |
|
| Method Summary | |
|---|---|
void |
clear()
Clears this hash table so that it contains no keys. |
boolean |
contains(java.lang.Object value)
Tests if some key maps into the specified value in this hash table. |
boolean |
containsKey(int key)
Tests if the specified object is a key in this hash table. |
boolean |
containsValue(java.lang.Object value)
Returns true if this HashMap maps one or more keys
to this value. |
V |
get(int key)
Returns the value to which the specified key is mapped in this map. |
boolean |
isEmpty()
Tests if this hash table maps no keys to values. |
V |
put(int key,
V value)
Maps the specified key to the specified
value in this hash table. |
void |
putAll(IntHashMap<? extends V> m)
Adds all elements from m to this. |
protected void |
rehash()
Increases the capacity of and internally reorganizes this hash table, in order to accommodate and access its entries more efficiently. |
V |
remove(int key)
Removes the key (and its corresponding value) from this hash table. |
int |
size()
Returns the number of keys in this hash table. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public IntHashMap()
Constructs a new, empty hash table with a default capacity and load
factor, which is 20 and 0.75 respectively.
public IntHashMap(int initialCapacity)
Constructs a new, empty hash table with the specified initial capacity
and default load factor, which is 0.75.
initialCapacity - the initial capacity of the hash table.
java.lang.IllegalArgumentException - if the initial capacity is less
than zero.
public IntHashMap(int initialCapacity,
float loadFactor)
Constructs a new, empty hash table with the specified initial capacity and the specified load factor.
initialCapacity - the initial capacity of the hash table.loadFactor - the load factor of the hash table.
java.lang.IllegalArgumentException - if the initial capacity is less
than zero, or if the load factor is nonpositive.public IntHashMap(IntHashMap<? extends V> m)
m - the IntHashMap to copy| Method Detail |
|---|
public void putAll(IntHashMap<? extends V> m)
public int size()
Returns the number of keys in this hash table.
public boolean isEmpty()
Tests if this hash table maps no keys to values.
true if this hash table maps no keys to values;
false otherwise.public boolean contains(java.lang.Object value)
Tests if some key maps into the specified value in this hash table.
This operation is more expensive than the containsKey
method.
Note that this method is identical in functionality to containsValue, (which is part of the Map interface in the collections framework).
value - a value to search for.
true if and only if some key maps to the
value argument in this hash table as
determined by the equals method;
false otherwise.
java.lang.NullPointerException - if the value is null.containsKey(int),
containsValue(Object),
Mappublic boolean containsValue(java.lang.Object value)
Returns true if this HashMap maps one or more keys
to this value.
Note that this method is identical in functionality to contains (which predates the Map interface).
value - value whose presence in this HashMap is to be tested.
Mappublic boolean containsKey(int key)
Tests if the specified object is a key in this hash table.
key - possible key.
true if and only if the specified object is a
key in this hash table, as determined by the equals
method; false otherwise.contains(Object)public V get(int key)
Returns the value to which the specified key is mapped in this map.
key - a key in the hash table.
null if the key is not mapped to any value in
this hash table.put(int, Object)protected void rehash()
Increases the capacity of and internally reorganizes this hash table, in order to accommodate and access its entries more efficiently.
This method is called automatically when the number of keys in the hash table exceeds this hashtable's capacity and load factor.
public V put(int key,
V value)
Maps the specified key to the specified
value in this hash table. The key cannot be
null.
The value can be retrieved by calling the get method
with a key that is equal to the original key.
key - the hash table key.value - the value.
null if it did not have one.
java.lang.NullPointerException - if the key is null.get(int)public V remove(int key)
Removes the key (and its corresponding value) from this hash table.
This method does nothing if the key is not present in the hash table.
key - the key that needs to be removed.
null if the key did not have a mapping.public void clear()
Clears this hash table so that it contains no keys.
public java.lang.String toString()
toString in class java.lang.Object
|
LimeWire collection component api | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||