aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2001-09-05 00:14:15 +0000
committerTom Tromey <tromey@gcc.gnu.org>2001-09-05 00:14:15 +0000
commitef671f41754b1eef032f3f284b0b1bc8941b7941 (patch)
treeb7dd4d926364b268113ef2244884dd0c479dce1b
parenta1f4e5ed0ad7c060fc1b90c3b363877cb8cca198 (diff)
downloadgcc-ef671f41754b1eef032f3f284b0b1bc8941b7941.zip
gcc-ef671f41754b1eef032f3f284b0b1bc8941b7941.tar.gz
gcc-ef671f41754b1eef032f3f284b0b1bc8941b7941.tar.bz2
AbstractMap.java: Re-merged with Classpath.
* java/util/AbstractMap.java: Re-merged with Classpath. * java/util/IdentityHashMap.java: Re-merged with Classpath. From-SVN: r45391
-rw-r--r--libjava/ChangeLog3
-rw-r--r--libjava/java/util/AbstractMap.java8
-rw-r--r--libjava/java/util/IdentityHashMap.java17
3 files changed, 25 insertions, 3 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 1a542aa..0a9400f 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,5 +1,8 @@
2001-09-04 Tom Tromey <tromey@redhat.com>
+ * java/util/AbstractMap.java: Re-merged with Classpath.
+ * java/util/IdentityHashMap.java: Re-merged with Classpath.
+
* java/text/SimpleDateFormat.java: Re-merged with Classpath.
* gnu/gcj/text/LocaleData.java, gnu/gcj/text/LocaleData_en.java,
gnu/gcj/text/LocaleData_en_US.java: Removed.
diff --git a/libjava/java/util/AbstractMap.java b/libjava/java/util/AbstractMap.java
index 7ce7305..e28ce91 100644
--- a/libjava/java/util/AbstractMap.java
+++ b/libjava/java/util/AbstractMap.java
@@ -47,6 +47,14 @@ public abstract class AbstractMap implements Map
entrySet().clear();
}
+ /**
+ * Create a shallow copy of this Map, no keys or values are copied.
+ */
+ protected Object clone () throws CloneNotSupportedException
+ {
+ return super.clone ();
+ }
+
public boolean containsKey(Object key)
{
Object k;
diff --git a/libjava/java/util/IdentityHashMap.java b/libjava/java/util/IdentityHashMap.java
index 5a1d76b..c23f8ac 100644
--- a/libjava/java/util/IdentityHashMap.java
+++ b/libjava/java/util/IdentityHashMap.java
@@ -83,11 +83,22 @@ public class IdentityHashMap extends AbstractMap
size = 0;
}
+ /**
+ * Creates a shallow copy where keys and values are not cloned.
+ */
public Object clone ()
{
- IdentityHashMap copy = (IdentityHashMap) super.clone ();
- copy.table = (Object[]) table.clone ();
- return copy;
+ try
+ {
+ IdentityHashMap copy = (IdentityHashMap) super.clone ();
+ copy.table = (Object[]) table.clone ();
+ return copy;
+ }
+ catch (CloneNotSupportedException e)
+ {
+ // Can't happen.
+ return null;
+ }
}
public boolean containsKey (Object key)