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