org.apache.bsf.debug.util

Class IntHashtable

Implemented Interfaces:
Cloneable

public class IntHashtable
extends java.lang.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

void
clear()
Removes all key/value pairs from this IntHashtable, leaving the size zero and the capacity unchanged.
Object
clone()
Answers a new IntHashtable with the same key/value pairs, capacity and load factor.
boolean
contains(Object value)
Answers if this Hashtable contains the specified object as the value of at least one of the key/value pairs.
boolean
containsKey(int key)
Answers if this Hashtable contains the specified object as a key of one of the key/value pairs.
Enumeration
elements()
Answers an Enumeration on the values of this Hashtable.
Object
get(int key)
Answers the value associated with the specified key in this Hashtable.
boolean
isEmpty()
Answers if this Hashtable has no key/value pairs, a size of zero.
Object
put(int key, Object value)
Associate the specified value with the specified key in this Hashtable.
protected void
rehash()
Increases the capacity of this Hashtable.
Object
remove(int key)
Remove the key/value pair with the specified key from this Hashtable.
int
size()
Answers the number of key/value pairs in this Hashtable.
String
toString()
Answers the string representation of this Hashtable.

Constructor Details

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 Details

clear

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

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:
containsKey(int), 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:
contains(Object), 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

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

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

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:
elements(), get(int), 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

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:
elements(), IntHashtable

toString

public String toString()
Answers the string representation of this Hashtable.
Returns:
the string representation of this Hashtable
Author:
OTI