+2000-12-17 Jeff Sturm <jeff.sturm@commerceone.com>
+
+ * java/util/Hashtable.java (put): Remove `last' variable.
+ Link new entry to head of list.
+ * java/util/HashMap.java (put): Ditto.
+
2000-12-15 Tom Tromey <tromey@redhat.com>
* java/util/ResourceBundle.java (trySomeGetBundle): Pass class
* @author Jon Zeppieri
* @author Jochen Hoenicke
* @author Bryce McKinlay
- * @version $Revision: 1.8 $
- * @modified $Id: HashMap.java,v 1.8 2000/10/26 10:19:00 bryce Exp $
+ * @version $Revision: 1.2 $
+ * @modified $Id: HashMap.java,v 1.2 2000/12/11 03:47:47 bryce Exp $
*/
public class HashMap extends AbstractMap
implements Map, Cloneable, Serializable
modCount++;
int idx = hash(key);
Entry e = buckets[idx];
- Entry last = e; // Final entry in bucket's linked list, if any.
while (e != null)
{
}
else
{
- last = e;
e = e.next;
}
}
e = new Entry(key, value);
- if (last != null)
- last.next = e;
- else
- buckets[idx] = e;
+ e.next = buckets[idx];
+ buckets[idx] = e;
return null;
}
* as per the Javasoft spec.
*
* @author Jon Zeppieri
- * @version $Revision: 1.8 $
- * @modified $Id: HashMap.java,v 1.8 2000/10/26 10:19:00 bryce Exp $
+ * @version $Revision: 1.2 $
+ * @modified $Id: HashMap.java,v 1.2 2000/12/11 03:47:47 bryce Exp $
*/
class HashIterator implements Iterator
{
* @author Jon Zeppieri
* @author Warren Levy
* @author Bryce McKinlay
- * @version $Revision: 1.7 $
- * @modified $Id: Hashtable.java,v 1.7 2000/12/11 03:47:47 bryce Exp $
+ * @version $Revision: 1.8 $
+ * @modified $Id: Hashtable.java,v 1.8 2000/12/11 04:54:55 bryce Exp $
*/
public class Hashtable extends Dictionary
implements Map, Cloneable, Serializable
modCount++;
int idx = hash(key);
HashMap.Entry e = buckets[idx];
- HashMap.Entry last = e; // Final entry in bucket's linked list, if any.
// Hashtable does not accept null values. This method doesn't dereference
// `value' anywhere, so check for it explicitly.
}
else
{
- last = e;
e = e.next;
}
}
e = new Entry(key, value);
- if (last != null)
- last.next = e;
- else
- buckets[idx] = e;
+ e.next = buckets[idx];
+ buckets[idx] = e;
return null;
}
* as per the Javasoft spec.
*
* @author Jon Zeppieri
- * @version $Revision: 1.7 $
- * @modified $Id: Hashtable.java,v 1.7 2000/12/11 03:47:47 bryce Exp $
+ * @version $Revision: 1.8 $
+ * @modified $Id: Hashtable.java,v 1.8 2000/12/11 04:54:55 bryce Exp $
*/
class HashIterator implements Iterator
{
* hashtable during enumeration causes indeterminate results. Don't do it!
*
* @author Jon Zeppieri
- * @version $Revision: 1.7 $
- * @modified $Id: Hashtable.java,v 1.7 2000/12/11 03:47:47 bryce Exp $ */
+ * @version $Revision: 1.8 $
+ * @modified $Id: Hashtable.java,v 1.8 2000/12/11 04:54:55 bryce Exp $ */
class Enumerator implements Enumeration
{
static final int KEYS = 0;