<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<!--NewPage-->
<html>
<head>
<!-- Generated by javadoc on Wed Jul 28 01:21:15 GMT 1999 -->
<title>
  Class java.util.Hashtable
</title>
</head>
<body>
<a name="_top_"></a>
<pre>
<a href="packages.html">All Packages</a>  <a href="tree.html">Class Hierarchy</a>  <a href="Package-java.util.html">This Package</a>  <a href="java.util.GregorianCalendar.html#_top_">Previous</a>  <a href="java.util.ListResourceBundle.html#_top_">Next</a>  <a href="AllNames.html">Index</a></pre>
<hr>
<h1>
  Class java.util.Hashtable
</h1>
<pre>
<a href="java.lang.Object.html#_top_">java.lang.Object</a>
   |
   +----<a href="java.util.Dictionary.html#_top_">java.util.Dictionary</a>
           |
           +----java.util.Hashtable
</pre>
<hr>
<dl>
  <dt> public class <b>Hashtable</b>
  <dt> extends <a href="java.util.Dictionary.html#_top_">Dictionary</a>
  <dt> implements <a href="java.lang.Cloneable.html#_top_">Cloneable</a>, <a href="java.io.Serializable.html#_top_">Serializable</a>
</dl>
This class implements a hashtable, which maps keys to values. Any 
 non-<code>null</code> object can be used as a key or as a value. 
 <p>
 To successfully store and retrieve objects from a hashtable, the 
 objects used as keys must implement the <code>hashCode</code> 
 method and the <code>equals</code> method. 
 <p>
 An instance of <code>Hashtable</code> has two parameters that 
 affect its efficiency: its <i>capacity</i> and its <i>load 
 factor</i>. The load factor should be between 0.0 and 1.0. When 
 the number of entries in the hashtable exceeds the product of the 
 load factor and the current capacity, the capacity is increased by 
 calling the <code>rehash</code> method. Larger load factors use 
 memory more efficiently, at the expense of larger expected time 
 per lookup. 
 <p>
 If many entries are to be made into a <code>Hashtable</code>, 
 creating it with a sufficiently large capacity may allow the 
 entries to be inserted more efficiently than letting it perform 
 automatic rehashing as needed to grow the table. 
 <p>
 This example creates a hashtable of numbers. It uses the names of 
 the numbers as keys: 
 <p><blockquote><pre>
     Hashtable numbers = new Hashtable();
     numbers.put("one", new Integer(1));
     numbers.put("two", new Integer(2));
     numbers.put("three", new Integer(3));
 </pre></blockquote>
 <p>
 To retrieve a number, use the following code: 
 <p><blockquote><pre>
     Integer n = (Integer)numbers.get("two");
     if (n != null) {
         System.out.println("two = " + n);
     }
 </pre></blockquote>
<p>
<dl>
    <dt> <b>See Also:</b>
    <dd> <a href="java.lang.Object.html#equals(java.lang.Object)">equals</a>, <a href="java.lang.Object.html#hashCode()">hashCode</a>, <a href="#rehash()">rehash</a>
</dl>
<hr>
<a name="index"></a>
<h2>
  <img src="images/constructor-index.gif" width=275 height=38 alt="Constructor Index">
</h2>
<dl>
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#Hashtable()"><b>Hashtable</b></a>()
  <dd>  Constructs a new, empty hashtable with a default capacity and load
 factor.
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#Hashtable(int)"><b>Hashtable</b></a>(int)
  <dd>  Constructs a new, empty hashtable with the specified initial capacity
 and default load factor.
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#Hashtable(int, float)"><b>Hashtable</b></a>(int, float)
  <dd>  Constructs a new, empty hashtable with the specified initial 
 capacity and the specified load factor.
</dl>
<h2>
  <img src="images/method-index.gif" width=207 height=38 alt="Method Index">
</h2>
<dl>
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#clear()"><b>clear</b></a>()
  <dd>  Clears this hashtable so that it contains no keys.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#clone()"><b>clone</b></a>()
  <dd>  Creates a shallow copy of this hashtable.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#contains(java.lang.Object)"><b>contains</b></a>(Object)
  <dd>  Tests if some key maps into the specified value in this hashtable.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#containsKey(java.lang.Object)"><b>containsKey</b></a>(Object)
  <dd>  Tests if the specified object is a key in this hashtable.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#elements()"><b>elements</b></a>()
  <dd>  Returns an enumeration of the values in this hashtable.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#get(java.lang.Object)"><b>get</b></a>(Object)
  <dd>  Returns the value to which the specified key is mapped in this hashtable.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#isEmpty()"><b>isEmpty</b></a>()
  <dd>  Tests if this hashtable maps no keys to values.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#keys()"><b>keys</b></a>()
  <dd>  Returns an enumeration of the keys in this hashtable.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#put(java.lang.Object, java.lang.Object)"><b>put</b></a>(Object, Object)
  <dd>  Maps the specified <code>key</code> to the specified 
 <code>value</code> in this hashtable.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#rehash()"><b>rehash</b></a>()
  <dd>  Rehashes the contents of the hashtable into a hashtable with a 
 larger capacity.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#remove(java.lang.Object)"><b>remove</b></a>(Object)
  <dd>  Removes the key (and its corresponding value) from this 
 hashtable.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#size()"><b>size</b></a>()
  <dd>  Returns the number of keys in this hashtable.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#toString()"><b>toString</b></a>()
  <dd>  Returns a rather long string representation of this hashtable.
</dl>
<a name="constructors"></a>
<h2>
  <img src="images/constructors.gif" width=231 height=38 alt="Constructors">
</h2>
<a name="Hashtable"></a>
<a name="Hashtable(int, float)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>Hashtable</b>
<pre>
 public Hashtable(int initialCapacity,
                  float loadFactor)
</pre>
<dl>
  <dd> Constructs a new, empty hashtable with the specified initial 
 capacity and the specified load factor.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> initialCapacity - the initial capacity of the hashtable.
    <dd> loadFactor - a number between 0.0 and 1.0.
    <dt> <b>Throws:</b> <a href="java.lang.IllegalArgumentException.html#_top_">IllegalArgumentException</a>
    <dd> if the initial capacity is less
               than or equal to zero, or if the load factor is less than
               or equal to zero.
  </dl></dd>
</dl>
<a name="Hashtable(int)"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>Hashtable</b>
<pre>
 public Hashtable(int initialCapacity)
</pre>
<dl>
  <dd> Constructs a new, empty hashtable with the specified initial capacity
 and default load factor.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> initialCapacity - the initial capacity of the hashtable.
  </dl></dd>
</dl>
<a name="Hashtable()"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>Hashtable</b>
<pre>
 public Hashtable()
</pre>
<dl>
  <dd> Constructs a new, empty hashtable with a default capacity and load
 factor.
<p>
</dl>
<a name="methods"></a>
<h2>
  <img src="images/methods.gif" width=151 height=38 alt="Methods">
</h2>
<a name="size()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="size"><b>size</b></a>
<pre>
 public int size()
</pre>
<dl>
  <dd> Returns the number of keys in this hashtable.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the number of keys in this hashtable.
    <dt> <b>Overrides:</b>
    <dd> <a href="java.util.Dictionary.html#size()">size</a> in class <a href="java.util.Dictionary.html#_top_">Dictionary</a>
  </dl></dd>
</dl>
<a name="isEmpty()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="isEmpty"><b>isEmpty</b></a>
<pre>
 public boolean isEmpty()
</pre>
<dl>
  <dd> Tests if this hashtable maps no keys to values.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> <code>true</code> if this hashtable maps no keys to values;
          <code>false</code> otherwise.
    <dt> <b>Overrides:</b>
    <dd> <a href="java.util.Dictionary.html#isEmpty()">isEmpty</a> in class <a href="java.util.Dictionary.html#_top_">Dictionary</a>
  </dl></dd>
</dl>
<a name="keys()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="keys"><b>keys</b></a>
<pre>
 public synchronized <a href="java.util.Enumeration.html#_top_">Enumeration</a> keys()
</pre>
<dl>
  <dd> Returns an enumeration of the keys in this hashtable.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> an enumeration of the keys in this hashtable.
    <dt> <b>Overrides:</b>
    <dd> <a href="java.util.Dictionary.html#keys()">keys</a> in class <a href="java.util.Dictionary.html#_top_">Dictionary</a>
    <dt> <b>See Also:</b>
    <dd> <a href="java.util.Enumeration.html#_top_">Enumeration</a>, <a href="#elements()">elements</a>
  </dl></dd>
</dl>
<a name="elements()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="elements"><b>elements</b></a>
<pre>
 public synchronized <a href="java.util.Enumeration.html#_top_">Enumeration</a> elements()
</pre>
<dl>
  <dd> Returns an enumeration of the values in this hashtable.
 Use the Enumeration methods on the returned object to fetch the elements
 sequentially.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> an enumeration of the values in this hashtable.
    <dt> <b>Overrides:</b>
    <dd> <a href="java.util.Dictionary.html#elements()">elements</a> in class <a href="java.util.Dictionary.html#_top_">Dictionary</a>
    <dt> <b>See Also:</b>
    <dd> <a href="java.util.Enumeration.html#_top_">Enumeration</a>, <a href="#keys()">keys</a>
  </dl></dd>
</dl>
<a name="contains(java.lang.Object)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="contains"><b>contains</b></a>
<pre>
 public synchronized boolean contains(<a href="java.lang.Object.html#_top_">Object</a> value)
</pre>
<dl>
  <dd> Tests if some key maps into the specified value in this hashtable.
 This operation is more expensive than the <code>containsKey</code>
 method.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> value - a value to search for.
    <dt> <b>Returns:</b>
    <dd> <code>true</code> if some key maps to the
             <code>value</code> argument in this hashtable;
             <code>false</code> otherwise.
    <dt> <b>Throws:</b> <a href="java.lang.NullPointerException.html#_top_">NullPointerException</a>
    <dd> if the value is <code>null</code>.
    <dt> <b>See Also:</b>
    <dd> <a href="#containsKey(java.lang.Object)">containsKey</a>
  </dl></dd>
</dl>
<a name="containsKey(java.lang.Object)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="containsKey"><b>containsKey</b></a>
<pre>
 public synchronized boolean containsKey(<a href="java.lang.Object.html#_top_">Object</a> key)
</pre>
<dl>
  <dd> Tests if the specified object is a key in this hashtable.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> key - possible key.
    <dt> <b>Returns:</b>
    <dd> <code>true</code> if the specified object is a key in this
          hashtable; <code>false</code> otherwise.
    <dt> <b>See Also:</b>
    <dd> <a href="#contains(java.lang.Object)">contains</a>
  </dl></dd>
</dl>
<a name="get(java.lang.Object)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="get"><b>get</b></a>
<pre>
 public synchronized <a href="java.lang.Object.html#_top_">Object</a> get(<a href="java.lang.Object.html#_top_">Object</a> key)
</pre>
<dl>
  <dd> Returns the value to which the specified key is mapped in this hashtable.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> key - a key in the hashtable.
    <dt> <b>Returns:</b>
    <dd> the value to which the key is mapped in this hashtable;
          <code>null</code> if the key is not mapped to any value in
          this hashtable.
    <dt> <b>Overrides:</b>
    <dd> <a href="java.util.Dictionary.html#get(java.lang.Object)">get</a> in class <a href="java.util.Dictionary.html#_top_">Dictionary</a>
    <dt> <b>See Also:</b>
    <dd> <a href="#put(java.lang.Object, java.lang.Object)">put</a>
  </dl></dd>
</dl>
<a name="rehash()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="rehash"><b>rehash</b></a>
<pre>
 protected void rehash()
</pre>
<dl>
  <dd> Rehashes the contents of the hashtable into a hashtable with a 
 larger capacity. This method is called automatically when the 
 number of keys in the hashtable exceeds this hashtable's capacity 
 and load factor.
<p>
</dl>
<a name="put(java.lang.Object, java.lang.Object)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="put"><b>put</b></a>
<pre>
 public synchronized <a href="java.lang.Object.html#_top_">Object</a> put(<a href="java.lang.Object.html#_top_">Object</a> key,
                                <a href="java.lang.Object.html#_top_">Object</a> value)
</pre>
<dl>
  <dd> Maps the specified <code>key</code> to the specified 
 <code>value</code> in this hashtable. Neither the key nor the 
 value can be <code>null</code>. 
 <p>
 The value can be retrieved by calling the <code>get</code> method 
 with a key that is equal to the original key.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> key - the hashtable key.
    <dd> value - the value.
    <dt> <b>Returns:</b>
    <dd> the previous value of the specified key in this hashtable,
             or <code>null</code> if it did not have one.
    <dt> <b>Throws:</b> <a href="java.lang.NullPointerException.html#_top_">NullPointerException</a>
    <dd> if the key or value is
               <code>null</code>.
    <dt> <b>Overrides:</b>
    <dd> <a href="java.util.Dictionary.html#put(java.lang.Object, java.lang.Object)">put</a> in class <a href="java.util.Dictionary.html#_top_">Dictionary</a>
    <dt> <b>See Also:</b>
    <dd> <a href="java.lang.Object.html#equals(java.lang.Object)">equals</a>, <a href="#get(java.lang.Object)">get</a>
  </dl></dd>
</dl>
<a name="remove(java.lang.Object)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="remove"><b>remove</b></a>
<pre>
 public synchronized <a href="java.lang.Object.html#_top_">Object</a> remove(<a href="java.lang.Object.html#_top_">Object</a> key)
</pre>
<dl>
  <dd> Removes the key (and its corresponding value) from this 
 hashtable. This method does nothing if the key is not in the hashtable.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> key - the key that needs to be removed.
    <dt> <b>Returns:</b>
    <dd> the value to which the key had been mapped in this hashtable,
          or <code>null</code> if the key did not have a mapping.
    <dt> <b>Overrides:</b>
    <dd> <a href="java.util.Dictionary.html#remove(java.lang.Object)">remove</a> in class <a href="java.util.Dictionary.html#_top_">Dictionary</a>
  </dl></dd>
</dl>
<a name="clear()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="clear"><b>clear</b></a>
<pre>
 public synchronized void clear()
</pre>
<dl>
  <dd> Clears this hashtable so that it contains no keys.
<p>
</dl>
<a name="clone()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="clone"><b>clone</b></a>
<pre>
 public synchronized <a href="java.lang.Object.html#_top_">Object</a> clone()
</pre>
<dl>
  <dd> Creates a shallow copy of this hashtable. The keys and values 
 themselves are not cloned. 
 This is a relatively expensive operation.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> a clone of the hashtable.
    <dt> <b>Overrides:</b>
    <dd> <a href="java.lang.Object.html#clone()">clone</a> in class <a href="java.lang.Object.html#_top_">Object</a>
  </dl></dd>
</dl>
<a name="toString()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="toString"><b>toString</b></a>
<pre>
 public synchronized <a href="java.lang.String.html#_top_">String</a> toString()
</pre>
<dl>
  <dd> Returns a rather long string representation of this hashtable.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> a string representation of this hashtable.
    <dt> <b>Overrides:</b>
    <dd> <a href="java.lang.Object.html#toString()">toString</a> in class <a href="java.lang.Object.html#_top_">Object</a>
  </dl></dd>
</dl>
<hr>
<pre>
<a href="packages.html">All Packages</a>  <a href="tree.html">Class Hierarchy</a>  <a href="Package-java.util.html">This Package</a>  <a href="java.util.GregorianCalendar.html#_top_">Previous</a>  <a href="java.util.ListResourceBundle.html#_top_">Next</a>  <a href="AllNames.html">Index</a></pre>
</body>
</html>
