diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | java/util/PriorityQueue.java | 3 |
2 files changed, 9 insertions, 0 deletions
@@ -1,3 +1,9 @@ +2006-09-13 Andrew Haley <aph@redhat.com> + + * java/util/PriorityQueue.java: Throw IllegalArgumentException for + capacity < 1. + (Iterator.remove()): Decrement index after removing element. + 2007-02-14 Jakub Jelinek <jakub@redhat.com> Andrew Haley <aph@redhat.com> diff --git a/java/util/PriorityQueue.java b/java/util/PriorityQueue.java index 470041e9d..e421418b6 100644 --- a/java/util/PriorityQueue.java +++ b/java/util/PriorityQueue.java @@ -108,6 +108,8 @@ public class PriorityQueue<E> extends AbstractQueue<E> implements Serializable public PriorityQueue(int cap, Comparator<? super E> comp) { + if (cap < 1) + throw new IllegalArgumentException(); this.used = 0; this.storage = (E[]) new Object[cap]; this.comparator = comp; @@ -170,6 +172,7 @@ public class PriorityQueue<E> extends AbstractQueue<E> implements Serializable public void remove() { PriorityQueue.this.remove(index); + index--; } }; } |