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