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