@Test public void iteratorTest () { final ShortQueue q = new ShortQueue(); for (int j = 0; j <= 6; j++) q.addLast((short) j); Iterator<Short> iter = q.iterator(); for (int j = 0; j <= 6; j++) assertEquals(iter.next().intValue(), j); iter = q.iterator(); iter.next(); iter.remove(); assertValues(q, 1, 2, 3, 4, 5, 6); iter.next(); iter.remove(); assertValues(q, 2, 3, 4, 5, 6); iter.next(); iter.next(); iter.remove(); assertValues(q, 2, 4, 5, 6); iter.next(); iter.next(); iter.next(); iter.remove(); assertValues(q, 2, 4, 5); q.clear(); for (int j = 2; j >= 0; j--) q.addFirst((short) j); for (int j = 3; j <= 6; j++) q.addLast((short) j); iter = q.iterator(); for (int j = 0; j <= 6; j++) assertEquals(iter.next().intValue(), j); iter = q.iterator(); iter.next(); iter.remove(); assertValues(q, 1, 2, 3, 4, 5, 6); iter.next(); iter.remove(); assertValues(q, 2, 3, 4, 5, 6); iter.next(); iter.next(); iter.remove(); assertValues(q, 2, 4, 5, 6); iter.next(); iter.next(); iter.next(); iter.remove(); assertValues(q, 2, 4, 5); }
public Iterator<Short> iterator () { if (iterable == null) iterable = new ShortQueueIterable(this); return iterable.iterator(); }
ShortQueue { public Iterator<Short> iterator () { if (iterable == null) iterable = new ShortQueueIterable(this); return iterable.iterator(); } }
ShortQueue { public Iterator<Short> iterator () { if (iterable == null) iterable = new ShortQueueIterable(this); return iterable.iterator(); } ShortQueue();  ShortQueue(int initialSize); }
ShortQueue { public Iterator<Short> iterator () { if (iterable == null) iterable = new ShortQueueIterable(this); return iterable.iterator(); } ShortQueue();  ShortQueue(int initialSize); void addLast(short object); void addFirst(short object); void ensureCapacity(int additional); short removeFirst(); short removeLast(); int indexOf(short value); boolean removeValue(short value); short removeIndex(int index); boolean notEmpty(); boolean isEmpty(); short first(); short last(); short get(int index); void clear(); Iterator<Short> iterator(); String toString(); String toString(String separator); int hashCode(); boolean equals(Object o); }
ShortQueue { public Iterator<Short> iterator () { if (iterable == null) iterable = new ShortQueueIterable(this); return iterable.iterator(); } ShortQueue();  ShortQueue(int initialSize); void addLast(short object); void addFirst(short object); void ensureCapacity(int additional); short removeFirst(); short removeLast(); int indexOf(short value); boolean removeValue(short value); short removeIndex(int index); boolean notEmpty(); boolean isEmpty(); short first(); short last(); short get(int index); void clear(); Iterator<Short> iterator(); String toString(); String toString(String separator); int hashCode(); boolean equals(Object o); public int size; }