From 7959aaaeb0f8f6661c0eb8b58b731a095ff5b410 Mon Sep 17 00:00:00 2001 From: Bryce McKinlay Date: Wed, 5 Apr 2006 18:32:27 +0000 Subject: 2006-04-05 Bryce McKinlay PR classpath/27028 PR classpath/24752 * java/util/AbstractList.java (hasNext): Don't throw ConcurrentModificationException. Update Javadoc. (hasPrevious): Likewise. (nextIndex): Likewise. (previousIndex): Likewise. * java/util/HashMap.java (hasNext): Likewise. * java/util/Hashtable.java (hasNext): Likewise. * java/util/IdentityHashMap.java (hasNext): Likewise. * java/util/LinkedHashMap.java (hasNext): Likewise. * java/util/LinkedList.java (nextIndex): Likewise. (previousIndex): Likewise. (hasNext): Likewise. (hasPrevious): Likewise. * java/util/TreeMap.java (hasNext): Likewise. * java/util/WeakHashMap.java (hasNext): Likewise. --- java/util/AbstractList.java | 25 ------------------------- java/util/HashMap.java | 3 --- java/util/Hashtable.java | 3 --- java/util/IdentityHashMap.java | 3 --- java/util/LinkedHashMap.java | 3 --- java/util/LinkedList.java | 8 -------- java/util/TreeMap.java | 3 --- java/util/WeakHashMap.java | 3 --- 8 files changed, 51 deletions(-) (limited to 'java') diff --git a/java/util/AbstractList.java b/java/util/AbstractList.java index 8a9b6f10d..114712eee 100644 --- a/java/util/AbstractList.java +++ b/java/util/AbstractList.java @@ -327,12 +327,9 @@ while (i.hasNext()) * * @return True if the end of the list has not yet been * reached. - * @throws ConcurrentModificationException if the - * list has been modified elsewhere. */ public boolean hasNext() { - checkMod(); return pos < size; } @@ -461,12 +458,9 @@ while (i.hasNext()) * * @return True if the end of the list has not yet been * reached. - * @throws ConcurrentModificationException if the - * list has been modified elsewhere. */ public boolean hasNext() { - checkMod(); return position < size; } @@ -476,12 +470,9 @@ while (i.hasNext()) * * @return True if objects exist prior to the current * position of the iterator. - * @throws ConcurrentModificationException if the - * list has been modified elsewhere. */ public boolean hasPrevious() { - checkMod(); return position > 0; } @@ -526,12 +517,9 @@ while (i.hasNext()) * list, which will be retrieved by next() * * @return The index of the next element. - * @throws ConcurrentModificationException if the list - * has been modified elsewhere. */ public int nextIndex() { - checkMod(); return position; } @@ -540,12 +528,9 @@ while (i.hasNext()) * list, which will be retrieved by previous() * * @return The index of the previous element. - * @throws ConcurrentModificationException if the list - * has been modified elsewhere. */ public int previousIndex() { - checkMod(); return position - 1; } @@ -1030,12 +1015,9 @@ while (i.hasNext()) * * @return True if the end of the list has not yet been * reached. - * @throws ConcurrentModificationException if the - * list has been modified elsewhere. */ public boolean hasNext() { - checkMod(); return position < size; } @@ -1045,12 +1027,9 @@ while (i.hasNext()) * * @return True if objects exist prior to the current * position of the iterator. - * @throws ConcurrentModificationException if the - * list has been modified elsewhere. */ public boolean hasPrevious() { - checkMod(); return position > 0; } @@ -1093,8 +1072,6 @@ while (i.hasNext()) * list, which will be retrieved by next() * * @return The index of the next element. - * @throws ConcurrentModificationException if the - * list has been modified elsewhere. */ public int nextIndex() { @@ -1106,8 +1083,6 @@ while (i.hasNext()) * list, which will be retrieved by previous() * * @return The index of the previous element. - * @throws ConcurrentModificationException if the - * list has been modified elsewhere. */ public int previousIndex() { diff --git a/java/util/HashMap.java b/java/util/HashMap.java index 7176db0d5..a734af484 100644 --- a/java/util/HashMap.java +++ b/java/util/HashMap.java @@ -849,12 +849,9 @@ public class HashMap extends AbstractMap /** * Returns true if the Iterator has more elements. * @return true if there are more elements - * @throws ConcurrentModificationException if the HashMap was modified */ public boolean hasNext() { - if (knownMod != modCount) - throw new ConcurrentModificationException(); return count > 0; } diff --git a/java/util/Hashtable.java b/java/util/Hashtable.java index 76b0d5c15..4c00d18a8 100644 --- a/java/util/Hashtable.java +++ b/java/util/Hashtable.java @@ -1017,12 +1017,9 @@ public class Hashtable extends Dictionary /** * Returns true if the Iterator has more elements. * @return true if there are more elements - * @throws ConcurrentModificationException if the hashtable was modified */ public boolean hasNext() { - if (knownMod != modCount) - throw new ConcurrentModificationException(); return count > 0; } diff --git a/java/util/IdentityHashMap.java b/java/util/IdentityHashMap.java index 6369fac69..89ef03415 100644 --- a/java/util/IdentityHashMap.java +++ b/java/util/IdentityHashMap.java @@ -705,12 +705,9 @@ public class IdentityHashMap extends AbstractMap /** * Returns true if the Iterator has more elements. * @return true if there are more elements - * @throws ConcurrentModificationException if the Map was modified */ public boolean hasNext() { - if (knownMod != modCount) - throw new ConcurrentModificationException(); return count > 0; } diff --git a/java/util/LinkedHashMap.java b/java/util/LinkedHashMap.java index 8e895a9e0..2b002b272 100644 --- a/java/util/LinkedHashMap.java +++ b/java/util/LinkedHashMap.java @@ -452,12 +452,9 @@ public class LinkedHashMap extends HashMap * Returns true if the Iterator has more elements. * * @return true if there are more elements - * @throws ConcurrentModificationException if the HashMap was modified */ public boolean hasNext() { - if (knownMod != modCount) - throw new ConcurrentModificationException(); return current != null; } diff --git a/java/util/LinkedList.java b/java/util/LinkedList.java index 2a35425fa..e77ae536b 100644 --- a/java/util/LinkedList.java +++ b/java/util/LinkedList.java @@ -804,11 +804,9 @@ public class LinkedList extends AbstractSequentialList * Returns the index of the next element. * * @return the next index - * @throws ConcurrentModificationException if the list was modified */ public int nextIndex() { - checkMod(); return position; } @@ -816,11 +814,9 @@ public class LinkedList extends AbstractSequentialList * Returns the index of the previous element. * * @return the previous index - * @throws ConcurrentModificationException if the list was modified */ public int previousIndex() { - checkMod(); return position - 1; } @@ -828,11 +824,9 @@ public class LinkedList extends AbstractSequentialList * Returns true if more elements exist via next. * * @return true if next will succeed - * @throws ConcurrentModificationException if the list was modified */ public boolean hasNext() { - checkMod(); return (next != null); } @@ -840,11 +834,9 @@ public class LinkedList extends AbstractSequentialList * Returns true if more elements exist via previous. * * @return true if previous will succeed - * @throws ConcurrentModificationException if the list was modified */ public boolean hasPrevious() { - checkMod(); return (previous != null); } diff --git a/java/util/TreeMap.java b/java/util/TreeMap.java index a00f257aa..60d0a4d50 100644 --- a/java/util/TreeMap.java +++ b/java/util/TreeMap.java @@ -1434,12 +1434,9 @@ public class TreeMap extends AbstractMap /** * Returns true if the Iterator has more elements. * @return true if there are more elements - * @throws ConcurrentModificationException if the TreeMap was modified */ public boolean hasNext() { - if (knownMod != modCount) - throw new ConcurrentModificationException(); return next != max; } diff --git a/java/util/WeakHashMap.java b/java/util/WeakHashMap.java index 2ed982ac3..ef2444c04 100644 --- a/java/util/WeakHashMap.java +++ b/java/util/WeakHashMap.java @@ -292,12 +292,9 @@ public class WeakHashMap extends AbstractMap implements Map /** * Checks if there are more entries. * @return true, iff there are more elements. - * @throws ConcurrentModificationException if the hash map was - * modified. */ public boolean hasNext() { - checkMod(); return nextEntry != null; } -- cgit v1.2.1