From ef5aa20db3883b23e82575fba7a4553325d9935f Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Fri, 22 Feb 2002 02:34:59 +0000 Subject: [PATCH] There is no backwards compatibility issue since this class is new since collections 1.0. Therefore, since the entire Map interface is implemented, there's no reason to inherit from HashMap. git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/collections/trunk@130553 13f79535-47bb-0310-9956-ffa450edef68 --- .../commons/collections/SequencedHashMap.java | 22 +++++++------------ 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/src/java/org/apache/commons/collections/SequencedHashMap.java b/src/java/org/apache/commons/collections/SequencedHashMap.java index 58ccec695..ec596d015 100644 --- a/src/java/org/apache/commons/collections/SequencedHashMap.java +++ b/src/java/org/apache/commons/collections/SequencedHashMap.java @@ -1,7 +1,7 @@ /* - * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/SequencedHashMap.java,v 1.4 2002/02/21 13:46:25 mas Exp $ - * $Revision: 1.4 $ - * $Date: 2002/02/21 13:46:25 $ + * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/java/org/apache/commons/collections/SequencedHashMap.java,v 1.5 2002/02/22 02:34:59 mas Exp $ + * $Revision: 1.5 $ + * $Date: 2002/02/22 02:34:59 $ * * ==================================================================== * @@ -78,15 +78,6 @@ import java.util.NoSuchElementException; * which they were added. This data structure has fast O(1) search * time, deletion time, and insertion time. * - * This class inherits from {@link java.util.HashMap} purely for backwards - * compatibility. It should really be inheriting from {@link - * java.util.AbstractMap}, or with a tiny extra bit of work, implement the - * full map interface on its own. APIs should not rely on this class being an - * actual {@link java.util.HashMap}, and instead should recognize it only as a - * generic {@link java.util.Map} (unless, of course, you need the sequencing - * functionality, but even in that case, this class should not be referred to - * as a java.util.HashMap). - * *

Although this map is sequenced, it cannot implement {@link * java.util.List} because of incompatible interface definitions. The remove * methods in List and Map have different return values (see: {@link @@ -100,7 +91,7 @@ import java.util.NoSuchElementException; * @author Daniel Rall * @author Henning P. Schmiedehausen */ -public class SequencedHashMap extends HashMap { +public class SequencedHashMap implements Map, Cloneable { /** * {@link java.util.Map.Entry} that doubles as a node in the linked list @@ -734,8 +725,11 @@ public class SequencedHashMap extends HashMap { * clone()'d. The cloned object maintains the same sequence. * * @return A clone of this instance. + * + * @exception CloneNotSupportedException if clone is not supported by a + * subclass. */ - public Object clone () { + public Object clone () throws CloneNotSupportException { // yes, calling super.clone() silly since we're just blowing away all // the stuff that super might be doing anyway, but for motivations on // this, see: