org.apache.bsf.debug.util

Class IntHashtable

public class IntHashtable extends Object implements Cloneable

Hashtable associates keys with values. Keys and values cannot be null. The size of the Hashtable is the number of key/value pairs it contains. The capacity is the number of key/value pairs the Hashtable can hold. The load factor is a float value which determines how full the Hashtable gets before expanding the capacity. If the load factor of the Hashtable is exceeded, the capacity is doubled.

Author: OTI

See Also: Enumeration java.io.Serializable java.lang.Object#equals java.lang.Object#hashCode

Constructor Summary
IntHashtable()
Constructs a new Hashtable using the default capacity and load factor.
IntHashtable(int capacity)
Constructs a new IntHashtable using the specified capacity and the default load factor.
IntHashtable(int capacity, float loadFactor)
Constructs a new IntHashtable using the specified capacity and load factor.
Method Summary
voidclear()
Removes all key/value pairs from this IntHashtable, leaving the size zero and the capacity unchanged.
Objectclone()
Answers a new IntHashtable with the same key/value pairs, capacity and load factor.
booleancontains(Object value)
Answers if this Hashtable contains the specified object as the value of at least one of the key/value pairs.
booleancontainsKey(int key)
Answers if this Hashtable contains the specified object as a key of one of the key/value pairs.
Enumerationelements()
Answers an Enumeration on the values of this Hashtable.
Objectget(int key)
Answers the value associated with the specified key in this Hashtable.
booleanisEmpty()
Answers if this Hashtable has no key/value pairs, a size of zero.
Objectput(int key, Object value)
Associate the specified value with the specified key in this Hashtable.
protected voidrehash()
Increases the capacity of this Hashtable.
Objectremove(int key)
Remove the key/value pair with the specified key from this Hashtable.
intsize()
Answers the number of key/value pairs in this Hashtable.
StringtoString()
Answers the string representation of this Hashtable.

Constructor Detail

IntHashtable

public IntHashtable()
Constructs a new Hashtable using the default capacity and load factor.

Author: OTI

IntHashtable

public IntHashtable(int capacity)
Constructs a new IntHashtable using the specified capacity and the default load factor.

Parameters: capacity the initial capacity

Author: OTI

IntHashtable

public IntHashtable(int capacity, float loadFactor)
Constructs a new IntHashtable using the specified capacity and load factor.

Parameters: capacity the initial capacity loadFactor the initial load factor

Author: OTI

Method Detail

clear

public void clear()
Removes all key/value pairs from this IntHashtable, leaving the size zero and the capacity unchanged.

Author: OTI

See Also: IntHashtable IntHashtable

clone

public Object clone()
Answers a new IntHashtable with the same key/value pairs, capacity and load factor.

Returns: a shallow copy of this IntHashtable

Author: OTI

See Also: java.lang.Cloneable

contains

public boolean contains(Object value)
Answers if this Hashtable contains the specified object as the value of at least one of the key/value pairs.

Parameters: value the object to look for as a value in this Hashtable

Returns: true if object is a value in this Hashtable, false otherwise

Author: OTI

See Also: IntHashtable java.lang.Object#equals

containsKey

public boolean containsKey(int key)
Answers if this Hashtable contains the specified object as a key of one of the key/value pairs.

Parameters: key the object to look for as a key in this Hashtable

Returns: true if object is a key in this Hashtable, false otherwise

Author: OTI

See Also: IntHashtable java.lang.Object#equals

elements

public Enumeration elements()
Answers an Enumeration on the values of this Hashtable. The results of the Enumeration may be affected if the contents of this Hashtable are modified.

Returns: an Enumeration of the values of this Hashtable

Author: OTI

See Also: IntHashtable IntHashtable Enumeration

get

public Object get(int key)
Answers the value associated with the specified key in this Hashtable.

Parameters: key the key of the value returned

Returns: the value associated with the specified key, null if the specified key does not exist

Author: OTI

See Also: IntHashtable

isEmpty

public boolean isEmpty()
Answers if this Hashtable has no key/value pairs, a size of zero.

Returns: true if this Hashtable has no key/value pairs, false otherwise

Author: OTI

See Also: IntHashtable

put

public Object put(int key, Object value)
Associate the specified value with the specified key in this Hashtable. If the key already exists, the old value is replaced. The key and value cannot be null.

Parameters: key the key to add value the value to add

Returns: the old value associated with the specified key, null if the key did not exist

Author: OTI

See Also: IntHashtable IntHashtable IntHashtable java.lang.Object#equals

rehash

protected void rehash()
Increases the capacity of this Hashtable. This method is sent when the size of this Hashtable exceeds the load factor.

Author: OTI

remove

public Object remove(int key)
Remove the key/value pair with the specified key from this Hashtable.

Parameters: key the key to remove

Returns: the value associated with the specified key, null if the specified key did not exist

Author: OTI

See Also: IntHashtable IntHashtable

size

public int size()
Answers the number of key/value pairs in this Hashtable.

Returns: the number of key/value pairs in this Hashtable

Author: OTI

See Also: IntHashtable IntHashtable

toString

public String toString()
Answers the string representation of this Hashtable.

Returns: the string representation of this Hashtable

Author: OTI