@Test public void toStringTest () { BooleanQueue q = new BooleanQueue(1); assertEquals("[]", q.toString()); q.addLast(true); assertEquals("[true]", q.toString()); q.addLast(false); q.addLast(false); q.addLast(true); assertEquals("[true, false, false, true]", q.toString()); }
public String toString () { if (size == 0) { return "[]"; } final boolean[] values = this.values; final int head = this.head; final int tail = this.tail; StringBuilder sb = new StringBuilder(64); sb.append('['); sb.append(values[head]); for (int i = (head + 1) % values.length; i != tail; i = (i + 1) % values.length) { sb.append(", ").append(values[i]); } sb.append(']'); return sb.toString(); }
BooleanQueue { public String toString () { if (size == 0) { return "[]"; } final boolean[] values = this.values; final int head = this.head; final int tail = this.tail; StringBuilder sb = new StringBuilder(64); sb.append('['); sb.append(values[head]); for (int i = (head + 1) % values.length; i != tail; i = (i + 1) % values.length) { sb.append(", ").append(values[i]); } sb.append(']'); return sb.toString(); } }
BooleanQueue { public String toString () { if (size == 0) { return "[]"; } final boolean[] values = this.values; final int head = this.head; final int tail = this.tail; StringBuilder sb = new StringBuilder(64); sb.append('['); sb.append(values[head]); for (int i = (head + 1) % values.length; i != tail; i = (i + 1) % values.length) { sb.append(", ").append(values[i]); } sb.append(']'); return sb.toString(); } BooleanQueue();  BooleanQueue(int initialSize); }
BooleanQueue { public String toString () { if (size == 0) { return "[]"; } final boolean[] values = this.values; final int head = this.head; final int tail = this.tail; StringBuilder sb = new StringBuilder(64); sb.append('['); sb.append(values[head]); for (int i = (head + 1) % values.length; i != tail; i = (i + 1) % values.length) { sb.append(", ").append(values[i]); } sb.append(']'); return sb.toString(); } 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 String toString () { if (size == 0) { return "[]"; } final boolean[] values = this.values; final int head = this.head; final int tail = this.tail; StringBuilder sb = new StringBuilder(64); sb.append('['); sb.append(values[head]); for (int i = (head + 1) % values.length; i != tail; i = (i + 1) % values.length) { sb.append(", ").append(values[i]); } sb.append(']'); return sb.toString(); } 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; }