@Test public void removeFirstTest() { ShortQueue queue = new ShortQueue(); queue.addLast((short) 1); queue.addLast((short) 2); queue.addLast((short) 3); queue.addLast((short) 4); assertEquals(4, queue.size); assertEquals(0, queue.indexOf((short) 1)); assertEquals(1, queue.removeFirst()); assertEquals(3, queue.size); assertEquals(0, queue.indexOf((short) 2)); assertEquals(2, queue.removeFirst()); assertEquals(2, queue.size); assertEquals(0, queue.indexOf((short) 3)); assertEquals(3, queue.removeFirst()); assertEquals(1, queue.size); assertEquals(0, queue.indexOf((short) 4)); assertEquals(4, queue.removeFirst()); assertEquals(0, queue.size); }
public short removeFirst () { if (size == 0) { throw new NoSuchElementException("Queue is empty."); } final short[] values = this.values; final short result = values[head]; head++; if (head == values.length) { head = 0; } size--; return result; }
ShortQueue { public short removeFirst () { if (size == 0) { throw new NoSuchElementException("Queue is empty."); } final short[] values = this.values; final short result = values[head]; head++; if (head == values.length) { head = 0; } size--; return result; } }
ShortQueue { public short removeFirst () { if (size == 0) { throw new NoSuchElementException("Queue is empty."); } final short[] values = this.values; final short result = values[head]; head++; if (head == values.length) { head = 0; } size--; return result; } ShortQueue();  ShortQueue(int initialSize); }
ShortQueue { public short removeFirst () { if (size == 0) { throw new NoSuchElementException("Queue is empty."); } final short[] values = this.values; final short result = values[head]; head++; if (head == values.length) { head = 0; } size--; return result; } ShortQueue();  ShortQueue(int initialSize); void addLast(short object); void addFirst(short object); void ensureCapacity(int additional); short removeFirst(); short removeLast(); int indexOf(short value); boolean removeValue(short value); short removeIndex(int index); boolean notEmpty(); boolean isEmpty(); short first(); short last(); short get(int index); void clear(); Iterator<Short> iterator(); String toString(); String toString(String separator); int hashCode(); boolean equals(Object o); }
ShortQueue { public short removeFirst () { if (size == 0) { throw new NoSuchElementException("Queue is empty."); } final short[] values = this.values; final short result = values[head]; head++; if (head == values.length) { head = 0; } size--; return result; } ShortQueue();  ShortQueue(int initialSize); void addLast(short object); void addFirst(short object); void ensureCapacity(int additional); short removeFirst(); short removeLast(); int indexOf(short value); boolean removeValue(short value); short removeIndex(int index); boolean notEmpty(); boolean isEmpty(); short first(); short last(); short get(int index); void clear(); Iterator<Short> iterator(); String toString(); String toString(String separator); int hashCode(); boolean equals(Object o); public int size; }