@Test public void toStringTest () { IntQueue q = new IntQueue(1); assertEquals("[]", q.toString()); q.addLast(4); assertEquals("[4]", q.toString()); q.addLast(5); q.addLast(6); q.addLast(7); assertEquals("[4, 5, 6, 7]", q.toString()); }
public String toString () { if (size == 0) { return "[]"; } final int[] 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(); }
IntQueue { public String toString () { if (size == 0) { return "[]"; } final int[] 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(); } }
IntQueue { public String toString () { if (size == 0) { return "[]"; } final int[] 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(); } IntQueue();  IntQueue(int initialSize); }
IntQueue { public String toString () { if (size == 0) { return "[]"; } final int[] 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(); } IntQueue();  IntQueue(int initialSize); void addLast(int object); void addFirst(int object); void ensureCapacity(int additional); int removeFirst(); int removeLast(); int indexOf(int value); boolean removeValue(int value); int removeIndex(int index); boolean notEmpty(); boolean isEmpty(); int first(); int last(); int get(int index); void clear(); Iterator<Integer> iterator(); String toString(); String toString(String separator); int hashCode(); boolean equals(Object o); }
IntQueue { public String toString () { if (size == 0) { return "[]"; } final int[] 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(); } IntQueue();  IntQueue(int initialSize); void addLast(int object); void addFirst(int object); void ensureCapacity(int additional); int removeFirst(); int removeLast(); int indexOf(int value); boolean removeValue(int value); int removeIndex(int index); boolean notEmpty(); boolean isEmpty(); int first(); int last(); int get(int index); void clear(); Iterator<Integer> iterator(); String toString(); String toString(String separator); int hashCode(); boolean equals(Object o); public int size; }