diff options
author | Eric Blake <ebb9@email.byu.edu> | 2003-01-03 17:00:03 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2003-01-03 17:00:03 +0000 |
commit | 29456fb8708444ebfa8d4fb7e660da171c813cac (patch) | |
tree | 4988d3eef804270ab6af5a8259a83d2aec547516 /libjava/java/util | |
parent | e392d367936c4ccf9a8378f56bafd4c7af6d94dd (diff) | |
download | gcc-29456fb8708444ebfa8d4fb7e660da171c813cac.zip gcc-29456fb8708444ebfa8d4fb7e660da171c813cac.tar.gz gcc-29456fb8708444ebfa8d4fb7e660da171c813cac.tar.bz2 |
TreeMap.java (fabricateTree): Fix off-by-one error.
2003-01-03 Eric Blake <ebb9@email.byu.edu>
* java/util/TreeMap.java (fabricateTree): Fix off-by-one error.
(TreeIterator.remove): Prefer IllegalStateException over
ConcurrentModificationException, to match Sun.
From-SVN: r60837
Diffstat (limited to 'libjava/java/util')
-rw-r--r-- | libjava/java/util/TreeMap.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libjava/java/util/TreeMap.java b/libjava/java/util/TreeMap.java index dfa9bc6..e0cff28 100644 --- a/libjava/java/util/TreeMap.java +++ b/libjava/java/util/TreeMap.java @@ -865,7 +865,7 @@ public class TreeMap extends AbstractMap int rowsize; // Fill each row that is completely full of nodes. - for (rowsize = 2; rowsize + rowsize < count; rowsize <<= 1) + for (rowsize = 2; rowsize + rowsize <= count; rowsize <<= 1) { Node parent = row; Node last = null; @@ -1468,10 +1468,10 @@ public class TreeMap extends AbstractMap */ public void remove() { - if (knownMod != modCount) - throw new ConcurrentModificationException(); if (last == null) throw new IllegalStateException(); + if (knownMod != modCount) + throw new ConcurrentModificationException(); removeNode(last); last = null; |