Class IntHashtable
A hash map that uses primitive ints for the key rather than objects.
public class IntHashtable
- Inheritance
-
IntHashtable
- Inherited Members
Remarks
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.Constructors
IntHashtable()
Constructs a new, empty hashtable with a default capacity and load
factor, which is 20
and 0.75
respectively.
public IntHashtable()
IntHashtable(int)
Constructs a new, empty hashtable with the specified initial capacity
and default load factor, which is 0.75
.
public IntHashtable(int initialCapacity)
Parameters
initialCapacity
intthe initial capacity of the hashtable.
IntHashtable(int, float)
Constructs a new, empty hashtable with the specified initial capacity and the specified load factor.
public IntHashtable(int initialCapacity, float loadFactor)
Parameters
initialCapacity
intthe initial capacity of the hashtable.
loadFactor
floatthe load factor of the hashtable.
IntHashtable(IntHashtable)
public IntHashtable(IntHashtable o)
Parameters
Methods
Clear()
Clears this hashtable so that it contains no keys.
public virtual void Clear()
Clone()
public virtual object Clone()
Returns
Contains(int)
Tests if some key maps into the specified value in this hashtable.
public virtual bool Contains(int value)
Parameters
value
inta value to search for.
Returns
- bool
true
if and only if some key maps to thevalue
argument in this hashtable as determined by the equals method;false
otherwise.
Remarks
Tests if some key maps into the specified value in this hashtable.
This operation is more expensive than the containsKey
method.
- See Also
ContainsKey(int)
Tests if the specified int is a key in this hashtable.
public virtual bool ContainsKey(int key)
Parameters
key
intpossible key.
Returns
- bool
true
if and only if the specified int is a key in this hashtable, as determined by the equals method;false
otherwise.
- See Also
ContainsValue(int)
Returns true
if this HashMap maps one or more keys
to this value.
public virtual bool ContainsValue(int value)
Parameters
value
intvalue whose presence in this HashMap is to be tested.
Returns
- bool
boolean
true
if the value is contained
Remarks
Returns true
if this HashMap maps one or more keys
to this value.
Get(int)
Returns the value to which the specified key is mapped in this map.
public virtual int Get(int key)
Parameters
key
inta key in the hashtable.
Returns
- int
the value to which the key is mapped in this hashtable; 0 if the key is not mapped to any value in this hashtable.
- See Also
GetKeys()
public virtual int[] GetKeys()
Returns
- int[]
GetOneKey()
public virtual int GetOneKey()
Returns
IsEmpty()
Tests if this hashtable maps no keys to values.
public virtual bool IsEmpty()
Returns
- bool
true
if this hashtable maps no keys to values;false
otherwise.
Put(int, int)
Maps the specified key
to the specified
value
in this hashtable.
public virtual int Put(int key, int value)
Parameters
Returns
- int
the previous value of the specified key in this hashtable, or
null
if it did not have one.
Remarks
Maps the specified key
to the specified
value
in this hashtable. The key cannot be
null
.
get
method
with a key that is equal to the original key.
- See Also
Rehash()
Increases the capacity of and internally reorganizes this hashtable, in order to accommodate and access its entries more efficiently.
protected virtual void Rehash()
Remarks
Increases the capacity of and internally reorganizes this hashtable, in order to accommodate and access its entries more efficiently.
This method is called automatically when the number of keys in the hashtable exceeds this hashtable's capacity and load factor.Remove(int)
Removes the key (and its corresponding value) from this hashtable.
public virtual int Remove(int key)
Parameters
key
intthe key that needs to be removed.
Returns
- int
the value to which the key had been mapped in this hashtable, or
null
if the key did not have a mapping.
Remarks
Removes the key (and its corresponding value) from this hashtable.
This method does nothing if the key is not present in the hashtable.Size()
Returns the number of keys in this hashtable.
public virtual int Size()
Returns
- int
the number of keys in this hashtable.
ToOrderedKeys()
public virtual int[] ToOrderedKeys()
Returns
- int[]