Commit 4984a8d3 by Jeff Sturm Committed by Bryce McKinlay

Hashtable.java (put): Remove `last' variable.

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.

From-SVN: r38325
parent c9cdc03e
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> 2000-12-15 Tom Tromey <tromey@redhat.com>
* java/util/ResourceBundle.java (trySomeGetBundle): Pass class * java/util/ResourceBundle.java (trySomeGetBundle): Pass class
......
...@@ -60,8 +60,8 @@ import java.io.ObjectOutputStream; ...@@ -60,8 +60,8 @@ import java.io.ObjectOutputStream;
* @author Jon Zeppieri * @author Jon Zeppieri
* @author Jochen Hoenicke * @author Jochen Hoenicke
* @author Bryce McKinlay * @author Bryce McKinlay
* @version $Revision: 1.8 $ * @version $Revision: 1.2 $
* @modified $Id: HashMap.java,v 1.8 2000/10/26 10:19:00 bryce Exp $ * @modified $Id: HashMap.java,v 1.2 2000/12/11 03:47:47 bryce Exp $
*/ */
public class HashMap extends AbstractMap public class HashMap extends AbstractMap
implements Map, Cloneable, Serializable implements Map, Cloneable, Serializable
...@@ -297,7 +297,6 @@ public class HashMap extends AbstractMap ...@@ -297,7 +297,6 @@ public class HashMap extends AbstractMap
modCount++; modCount++;
int idx = hash(key); int idx = hash(key);
Entry e = buckets[idx]; Entry e = buckets[idx];
Entry last = e; // Final entry in bucket's linked list, if any.
while (e != null) while (e != null)
{ {
...@@ -309,7 +308,6 @@ public class HashMap extends AbstractMap ...@@ -309,7 +308,6 @@ public class HashMap extends AbstractMap
} }
else else
{ {
last = e;
e = e.next; e = e.next;
} }
} }
...@@ -324,10 +322,8 @@ public class HashMap extends AbstractMap ...@@ -324,10 +322,8 @@ public class HashMap extends AbstractMap
e = new Entry(key, value); e = new Entry(key, value);
if (last != null) e.next = buckets[idx];
last.next = e; buckets[idx] = e;
else
buckets[idx] = e;
return null; return null;
} }
...@@ -664,8 +660,8 @@ public class HashMap extends AbstractMap ...@@ -664,8 +660,8 @@ public class HashMap extends AbstractMap
* as per the Javasoft spec. * as per the Javasoft spec.
* *
* @author Jon Zeppieri * @author Jon Zeppieri
* @version $Revision: 1.8 $ * @version $Revision: 1.2 $
* @modified $Id: HashMap.java,v 1.8 2000/10/26 10:19:00 bryce Exp $ * @modified $Id: HashMap.java,v 1.2 2000/12/11 03:47:47 bryce Exp $
*/ */
class HashIterator implements Iterator class HashIterator implements Iterator
{ {
......
...@@ -64,8 +64,8 @@ import java.io.ObjectOutputStream; ...@@ -64,8 +64,8 @@ import java.io.ObjectOutputStream;
* @author Jon Zeppieri * @author Jon Zeppieri
* @author Warren Levy * @author Warren Levy
* @author Bryce McKinlay * @author Bryce McKinlay
* @version $Revision: 1.7 $ * @version $Revision: 1.8 $
* @modified $Id: Hashtable.java,v 1.7 2000/12/11 03:47:47 bryce Exp $ * @modified $Id: Hashtable.java,v 1.8 2000/12/11 04:54:55 bryce Exp $
*/ */
public class Hashtable extends Dictionary public class Hashtable extends Dictionary
implements Map, Cloneable, Serializable implements Map, Cloneable, Serializable
...@@ -295,7 +295,6 @@ public class Hashtable extends Dictionary ...@@ -295,7 +295,6 @@ public class Hashtable extends Dictionary
modCount++; modCount++;
int idx = hash(key); int idx = hash(key);
HashMap.Entry e = buckets[idx]; 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 // Hashtable does not accept null values. This method doesn't dereference
// `value' anywhere, so check for it explicitly. // `value' anywhere, so check for it explicitly.
...@@ -312,7 +311,6 @@ public class Hashtable extends Dictionary ...@@ -312,7 +311,6 @@ public class Hashtable extends Dictionary
} }
else else
{ {
last = e;
e = e.next; e = e.next;
} }
} }
...@@ -327,10 +325,8 @@ public class Hashtable extends Dictionary ...@@ -327,10 +325,8 @@ public class Hashtable extends Dictionary
e = new Entry(key, value); e = new Entry(key, value);
if (last != null) e.next = buckets[idx];
last.next = e; buckets[idx] = e;
else
buckets[idx] = e;
return null; return null;
} }
...@@ -724,8 +720,8 @@ public class Hashtable extends Dictionary ...@@ -724,8 +720,8 @@ public class Hashtable extends Dictionary
* as per the Javasoft spec. * as per the Javasoft spec.
* *
* @author Jon Zeppieri * @author Jon Zeppieri
* @version $Revision: 1.7 $ * @version $Revision: 1.8 $
* @modified $Id: Hashtable.java,v 1.7 2000/12/11 03:47:47 bryce Exp $ * @modified $Id: Hashtable.java,v 1.8 2000/12/11 04:54:55 bryce Exp $
*/ */
class HashIterator implements Iterator class HashIterator implements Iterator
{ {
...@@ -829,8 +825,8 @@ public class Hashtable extends Dictionary ...@@ -829,8 +825,8 @@ public class Hashtable extends Dictionary
* hashtable during enumeration causes indeterminate results. Don't do it! * hashtable during enumeration causes indeterminate results. Don't do it!
* *
* @author Jon Zeppieri * @author Jon Zeppieri
* @version $Revision: 1.7 $ * @version $Revision: 1.8 $
* @modified $Id: Hashtable.java,v 1.7 2000/12/11 03:47:47 bryce Exp $ */ * @modified $Id: Hashtable.java,v 1.8 2000/12/11 04:54:55 bryce Exp $ */
class Enumerator implements Enumeration class Enumerator implements Enumeration
{ {
static final int KEYS = 0; static final int KEYS = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment