DefaultPriorityQueue extends AbstractQueue<T> implements PriorityQueue<T> { @Override public void clearIgnoringIndexes() { size = 0; } @SuppressWarnings("unchecked")  DefaultPriorityQueue(Comparator<T> comparator, int initialSize); @Override int size(); @Override boolean isEmpty(); @Override boolean contains(Object o); @Override boolean containsTyped(T node); @Override void clear(); @Override void clearIgnoringIndexes(); @Override boolean offer(T e); @Override T poll(); @Override T peek(); @SuppressWarnings("unchecked") @Override boolean remove(Object o); @Override boolean removeTyped(T node); @Override void priorityChanged(T node); @Override Object[] toArray(); @SuppressWarnings("unchecked") @Override X[] toArray(X[] a); @Override Iterator<T> iterator();  }
@Test public void testClearIgnoringIndexes() { PriorityQueue<TestElement> queue = new DefaultPriorityQueue<TestElement>(TestElementComparator.INSTANCE, 0); assertEmptyQueue(queue); TestElement a = new TestElement(5); TestElement b = new TestElement(10); TestElement c = new TestElement(2); TestElement d = new TestElement(6); TestElement e = new TestElement(11); assertOffer(queue, a); assertOffer(queue, b); assertOffer(queue, c); assertOffer(queue, d); queue.clearIgnoringIndexes(); assertEmptyQueue(queue); try { queue.offer(a); fail(); } catch (IllegalArgumentException t) { } assertOffer(queue, e); assertSame(e, queue.peek()); }