Class Hashtable
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class Hashtable

public class netscape.util.Hashtable
    extends java.lang.Object
    implements java.lang.Cloneable,
               netscape.util.Codable
{
    /* Constructors
     */
    public Hashtable();
    public Hashtable(int);

    /* Methods
     */
    public void clear();
    public Object clone();
    public boolean contains(Object);
    public boolean containsKey(Object);
    public int count();
    public void decode(Decoder);
    public void describeClassInfo(ClassInfo);
    public Enumeration elements();
    public Object[] elementsArray();
    public Vector elementsVector();
    public void encode(Encoder);
    public void finishDecoding();
    public Object get(Object);
    public boolean isEmpty();
    public Enumeration keys();
    public Object[] keysArray();
    public Vector keysVector();
    public Object put(Object, Object);
    public Object remove(Object);
    public int size();
    public String toString();
}
Object subclass that implements a hash table.

Constructors

Hashtable

  public Hashtable()
Constructs an empty Hashtable. The Hashtable will grow on demand as more elements are added.

Hashtable

  public Hashtable(int initialCapacity)
Constructs a Hashtable capable of holding at least initialCapacity elements before needing to grow.

Methods

clone

  public Object clone()
Creates a shallow copy of the Hashtable. The table itself is cloned, but none of the keys or elements are copied.
Overrides:
clone in class Object

count

  public int count()
Returns the number of elements in the Hashtable.

size

  public int size()
Returns the number of elements in the Hashtable.

isEmpty

  public boolean isEmpty()
Returns true if there are no elements in the Hashtable.

keys

  public Enumeration keys()
Returns an Enumeration of the Hashtable's keys.
See Also:
elements

elements

  public Enumeration elements()
Returns an Enumeration of the Hashtable's elements.
See Also:
keys

keysVector

  public Vector keysVector()
Returns a Vector containing the Hashtable's keys.

elementsVector

  public Vector elementsVector()
Returns a Vector containing the Hashtable's elements.

keysArray

  public Object[] keysArray()
Returns an Object array containing the Hashtable's keys.

elementsArray

  public Object[] elementsArray()
Returns an Object array containing the Hashtable's elements.

contains

  public boolean contains(Object element)
Returns true if the Hashtable contains the element. This method is slow -- O(n) -- because it must scan the table searching for the element.

containsKey

  public boolean containsKey(Object key)
Returns true if the Hashtable contains the key key.

get

  public Object get(Object key)
Returns the element associated with the key. This method returns null if the Hashtable does not contain key. Hashtable hashes and compares key using hashCode() and equals().

remove

  public Object remove(Object key)
Removes key and the element associated with it from the Hashtable. Returns the element associated with key, or null if key was not present.

put

  public Object put(Object key,
                    Object element)
Places the key/element pair in the Hashtable. Neither key nor element may be null. Returns the old element associated with key, or null if the key was not present.

clear

  public void clear()
Removes all keys and elements from the Hashtable.

toString

  public String toString()
Returns a string serialization of the Hashtable using the Serializer.
Overrides:
toString in class Object
See Also:
Serializer

describeClassInfo

  public void describeClassInfo(ClassInfo info)
Describes the Hashtable class' information.
See Also:
describeClassInfo

encode

  public void encode(Encoder encoder) throws CodingException
Encodes the Hashtable instance. All the keys and elements must be Codable.
See Also:
encode

decode

  public void decode(Decoder decoder) throws CodingException
Decodes the Hashtable instance.
See Also:
decode

finishDecoding

  public void finishDecoding() throws CodingException
Finishes the Hashtable's decoding.
See Also:
finishDecoding

All Packages  Class Hierarchy  This Package  Previous  Next  Index