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