From a142a996267f9c8adf239a565725174265c67749 Mon Sep 17 00:00:00 2001 From: Bryce McKinlay Date: Wed, 14 Feb 2001 04:44:21 +0000 Subject: re PR libgcj/1758 (java.util package lacks TreeMap) * java/util/TreeMap.java: New file. * java/util/TreeSet.java: New file. * Makefile.am: Add TreeMap and TreeSet. Enable WeakHashMap. * Makefile.in: Rebuilt. * java/util/HashSet.java (clone): Use constructor instead of calling clone on itself. * java/util/SortedSet.java: Sync with classpath. * java/util/HashMap.java (hash): Use if statement instead of ternary, for clarity. Resolves PR libgcj/1758. Resolves PR java/1684. From-SVN: r39657 --- libjava/java/util/HashMap.java | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'libjava/java/util/HashMap.java') diff --git a/libjava/java/util/HashMap.java b/libjava/java/util/HashMap.java index b7ec3b4..6304333 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.3 $ - * @modified $Id: HashMap.java,v 1.3 2000/12/17 09:15:51 bryce Exp $ + * @version $Revision: 1.4 $ + * @modified $Id: HashMap.java,v 1.4 2000/12/21 02:00:15 bryce Exp $ */ public class HashMap extends AbstractMap implements Map, Cloneable, Serializable @@ -500,7 +500,10 @@ public class HashMap extends AbstractMap /** Return an index in the buckets array for `key' based on its hashCode() */ private int hash(Object key) { - return (key == null ? 0 : Math.abs(key.hashCode() % buckets.length)); + if (key == null) + return 0; + else + return Math.abs(key.hashCode() % buckets.length); } /** Return an Entry who's key and value equal the supplied Map.Entry. @@ -611,15 +614,13 @@ public class HashMap extends AbstractMap } /** - * a class which implements the Iterator interface and is used for - * iterating over HashMaps; - * this implementation is parameterized to give a sequential view of - * keys, values, or entries; it also allows the removal of elements, - * as per the Javasoft spec. + * Iterate over HashMap's entries. + * This implementation is parameterized to give a sequential view of + * keys, values, or entries. * * @author Jon Zeppieri - * @version $Revision: 1.3 $ - * @modified $Id: HashMap.java,v 1.3 2000/12/17 09:15:51 bryce Exp $ + * @version $Revision: 1.4 $ + * @modified $Id: HashMap.java,v 1.4 2000/12/21 02:00:15 bryce Exp $ */ class HashIterator implements Iterator { -- cgit v1.1