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