@Test public void iteratorTest () { final LongQueue q = new LongQueue(); for (int j = 0; j <= 6; j++) q.addLast(j); Iterator<Long> 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(j); for (int j = 3; j <= 6; j++) q.addLast(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<Long> iterator () { if (iterable == null) iterable = new LongQueueIterable(this); return iterable.iterator(); }
LongQueue { public Iterator<Long> iterator () { if (iterable == null) iterable = new LongQueueIterable(this); return iterable.iterator(); } }
LongQueue { public Iterator<Long> iterator () { if (iterable == null) iterable = new LongQueueIterable(this); return iterable.iterator(); } LongQueue();  LongQueue(int initialSize); }
LongQueue { public Iterator<Long> iterator () { if (iterable == null) iterable = new LongQueueIterable(this); return iterable.iterator(); } LongQueue();  LongQueue(int initialSize); void addLast(long object); void addFirst(long object); void ensureCapacity(int additional); long removeFirst(); long removeLast(); int indexOf(long value); boolean removeValue(long value); long removeIndex(int index); boolean notEmpty(); boolean isEmpty(); long first(); long last(); long get(int index); void clear(); Iterator<Long> iterator(); String toString(); String toString(String separator); int hashCode(); boolean equals(Object o); }
LongQueue { public Iterator<Long> iterator () { if (iterable == null) iterable = new LongQueueIterable(this); return iterable.iterator(); } LongQueue();  LongQueue(int initialSize); void addLast(long object); void addFirst(long object); void ensureCapacity(int additional); long removeFirst(); long removeLast(); int indexOf(long value); boolean removeValue(long value); long removeIndex(int index); boolean notEmpty(); boolean isEmpty(); long first(); long last(); long get(int index); void clear(); Iterator<Long> iterator(); String toString(); String toString(String separator); int hashCode(); boolean equals(Object o); public int size; }