summaryrefslogtreecommitdiff
path: root/libjava/java/util/HashMap.java
diff options
context:
space:
mode:
authorbryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4>2000-12-21 02:00:15 +0000
committerbryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4>2000-12-21 02:00:15 +0000
commit887b528a0bf765a69e4ed9fcb731f91b146dbc43 (patch)
tree150b778219ba57eefde0f3fab0eda27eb0e43f4d /libjava/java/util/HashMap.java
parent5ce8da41186c2b7f5cc76dc9b7d03a934814a00b (diff)
downloadgcc-887b528a0bf765a69e4ed9fcb731f91b146dbc43.tar.gz
* java/util/BasicMapEntry.java: Re-added.
* java/util/HashMap.java (Entry): Extend BasicMapEntry. (putAll): Test for BasicMapEntry. * java/util/Hashtable.java (Entry): Extend BasicMapEntry. (putAll): Test for BasicMapEntry. Change references from `HashMap.Entry' to `Entry' in various places. * Makefile.am: Add BasicMapEntry.java. * Makefile.in: Rebuilt. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@38410 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/util/HashMap.java')
-rw-r--r--libjava/java/util/HashMap.java60
1 files changed, 9 insertions, 51 deletions
diff --git a/libjava/java/util/HashMap.java b/libjava/java/util/HashMap.java
index 9acbadb6da9..b7ec3b49f4d 100644
--- a/libjava/java/util/HashMap.java
+++ b/libjava/java/util/HashMap.java
@@ -60,8 +60,8 @@ import java.io.ObjectOutputStream;
* @author Jon Zeppieri
* @author Jochen Hoenicke
* @author Bryce McKinlay
- * @version $Revision: 1.2 $
- * @modified $Id: HashMap.java,v 1.2 2000/12/11 03:47:47 bryce Exp $
+ * @version $Revision: 1.3 $
+ * @modified $Id: HashMap.java,v 1.3 2000/12/17 09:15:51 bryce Exp $
*/
public class HashMap extends AbstractMap
implements Map, Cloneable, Serializable
@@ -69,7 +69,7 @@ public class HashMap extends AbstractMap
/** Default number of buckets. This is the value the JDK 1.3 uses. Some
* early documentation specified this value as 101. That is incorrect. */
private static final int DEFAULT_CAPACITY = 11;
- /** The defaulty load factor; this is explicitly specified by Sun */
+ /** The defaulty load factor; this is explicitly specified by the spec. */
private static final float DEFAULT_LOAD_FACTOR = 0.75f;
private static final long serialVersionUID = 362498820763181265L;
@@ -104,56 +104,14 @@ public class HashMap extends AbstractMap
* Class to represent an entry in the hash table. Holds a single key-value
* pair.
*/
- static class Entry implements Map.Entry
+ static class Entry extends BasicMapEntry
{
- Object key;
- Object value;
Entry next;
Entry(Object key, Object value)
{
- this.key = key;
- this.value = value;
+ super(key, value);
}
-
- public boolean equals(Object o)
- {
- if (!(o instanceof Map.Entry))
- return false;
- Map.Entry e = (Map.Entry) o;
- return (key == null ? e.getKey() == null : key.equals(e.getKey())
- && value == null ? e.getValue() == null :
- value.equals(e.getValue()));
- }
-
- public Object getKey()
- {
- return key;
- }
-
- public Object getValue()
- {
- return value;
- }
-
- public int hashCode()
- {
- int kc = (key == null ? 0 : key.hashCode());
- int vc = (value == null ? 0 : value.hashCode());
- return kc ^ vc;
- }
-
- public Object setValue(Object newVal)
- {
- Object r = value;
- value = newVal;
- return r;
- }
-
- public String toString()
- {
- return key + "=" + value;
- }
}
/**
@@ -368,9 +326,9 @@ public class HashMap extends AbstractMap
{
Map.Entry e = (Map.Entry) itr.next();
// Optimize in case the Entry is one of our own.
- if (e instanceof Entry)
+ if (e instanceof BasicMapEntry)
{
- Entry entry = (Entry) e;
+ BasicMapEntry entry = (BasicMapEntry) e;
put(entry.key, entry.value);
}
else
@@ -660,8 +618,8 @@ public class HashMap extends AbstractMap
* as per the Javasoft spec.
*
* @author Jon Zeppieri
- * @version $Revision: 1.2 $
- * @modified $Id: HashMap.java,v 1.2 2000/12/11 03:47:47 bryce Exp $
+ * @version $Revision: 1.3 $
+ * @modified $Id: HashMap.java,v 1.3 2000/12/17 09:15:51 bryce Exp $
*/
class HashIterator implements Iterator
{