diff options
Diffstat (limited to 'libjava/java/util/LinkedHashMap.java')
-rw-r--r-- | libjava/java/util/LinkedHashMap.java | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/libjava/java/util/LinkedHashMap.java b/libjava/java/util/LinkedHashMap.java index 8950d58..8503e37 100644 --- a/libjava/java/util/LinkedHashMap.java +++ b/libjava/java/util/LinkedHashMap.java @@ -28,11 +28,6 @@ executable file might be covered by the GNU General Public License. */ package java.util; -import java.io.IOException; -import java.io.Serializable; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; - /** * This class provides a hashtable-backed implementation of the * Map interface, with predictable traversal order. @@ -89,6 +84,7 @@ import java.io.ObjectOutputStream; * @see TreeMap * @see Hashtable * @since 1.4 + * @status updated to 1.4 */ public class LinkedHashMap extends HashMap { @@ -218,8 +214,8 @@ public class LinkedHashMap extends HashMap * Construct a new insertion-ordered LinkedHashMap with a specific * inital capacity and default load factor of 0.75. * - * @param initialCapacity the initial capacity of this HashMap (>=0) - * @throws IllegalArgumentException if (initialCapacity < 0) + * @param initialCapacity the initial capacity of this HashMap (>= 0) + * @throws IllegalArgumentException if (initialCapacity < 0) */ public LinkedHashMap(int initialCapacity) { @@ -231,10 +227,10 @@ public class LinkedHashMap extends HashMap * Construct a new insertion-orderd LinkedHashMap with a specific * inital capacity and load factor. * - * @param initialCapacity the initial capacity (>=0) - * @param loadFactor the load factor (>0, not NaN) - * @throws IllegalArgumentException if (initialCapacity < 0) || - * ! (loadFactor > 0.0) + * @param initialCapacity the initial capacity (>= 0) + * @param loadFactor the load factor (> 0, not NaN) + * @throws IllegalArgumentException if (initialCapacity < 0) || + * ! (loadFactor > 0.0) */ public LinkedHashMap(int initialCapacity, float loadFactor) { @@ -281,7 +277,7 @@ public class LinkedHashMap extends HashMap LinkedHashEntry e = head; while (e != null) { - if (value == null ? e.value == null : value.equals(e.value)) + if (equals(value, e.value)) return true; e = e.succ; } @@ -307,7 +303,7 @@ public class LinkedHashMap extends HashMap HashEntry e = buckets[idx]; while (e != null) { - if (key == null ? e.key == null : key.equals(e.key)) + if (equals(key, e.key)) { if (accessOrder) { @@ -376,13 +372,14 @@ public class LinkedHashMap extends HashMap return false; } - /** Helper method called by <code>put</code>, which creates and adds a + /** + * Helper method called by <code>put</code>, which creates and adds a * new Entry, followed by performing bookkeeping (like removeEldestEntry). * * @param key the key of the new Entry * @param value the value * @param idx the index in buckets where the new Entry belongs - * @param callRemove Whether to call the removeEldestEntry method. + * @param callRemove whether to call the removeEldestEntry method * @see #put(Object, Object) * @see #removeEldestEntry(Map.Entry) */ @@ -397,6 +394,11 @@ public class LinkedHashMap extends HashMap remove(head); } + /** + * Helper method, called by clone() to reset the doubly-linked list. + * @param m the map to add entries from + * @see #clone() + */ void putAllInternal(Map m) { head = null; @@ -466,8 +468,8 @@ public class LinkedHashMap extends HashMap throw new IllegalStateException(); LinkedHashMap.this.remove(last.key); - knownMod++; last = null; + knownMod++; } }; } |