@Test public void removeFirstTest() { FloatQueue queue = new FloatQueue(); queue.addLast((float) 1); queue.addLast((float) 2); queue.addLast((float) 3); queue.addLast((float) 4); assertEquals(4, queue.size); assertEquals(0, queue.indexOf((float) 1), 0.01); assertEquals(1, queue.removeFirst(), 0.01); assertEquals(3, queue.size); assertEquals(0, queue.indexOf((float) 2), 0.01); assertEquals(2, queue.removeFirst(), 0.01); assertEquals(2, queue.size); assertEquals(0, queue.indexOf((float) 3), 0.01); assertEquals(3, queue.removeFirst(), 0.01); assertEquals(1, queue.size); assertEquals(0, queue.indexOf((float) 4), 0.01); assertEquals(4, queue.removeFirst(), 0.01); assertEquals(0, queue.size); }
public float removeFirst () { if (size == 0) { throw new NoSuchElementException("Queue is empty."); } final float[] values = this.values; final float result = values[head]; head++; if (head == values.length) { head = 0; } size--; return result; }
FloatQueue { public float removeFirst () { if (size == 0) { throw new NoSuchElementException("Queue is empty."); } final float[] values = this.values; final float result = values[head]; head++; if (head == values.length) { head = 0; } size--; return result; } }
FloatQueue { public float removeFirst () { if (size == 0) { throw new NoSuchElementException("Queue is empty."); } final float[] values = this.values; final float result = values[head]; head++; if (head == values.length) { head = 0; } size--; return result; } FloatQueue();  FloatQueue(int initialSize); }
FloatQueue { public float removeFirst () { if (size == 0) { throw new NoSuchElementException("Queue is empty."); } final float[] values = this.values; final float result = values[head]; head++; if (head == values.length) { head = 0; } size--; return result; } 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 float removeFirst () { if (size == 0) { throw new NoSuchElementException("Queue is empty."); } final float[] values = this.values; final float result = values[head]; head++; if (head == values.length) { head = 0; } size--; return result; } 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; }