@Test public void toStringTest () { ShortQueue q = new ShortQueue(1); assertEquals("[]", q.toString()); q.addLast((short) 4); assertEquals("[4]", q.toString()); q.addLast((short) 5); q.addLast((short) 6); q.addLast((short) 7); assertEquals("[4, 5, 6, 7]", q.toString()); }
public String toString () { if (size == 0) { return "[]"; } final short[] 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(); }
ShortQueue { public String toString () { if (size == 0) { return "[]"; } final short[] 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(); } }
ShortQueue { public String toString () { if (size == 0) { return "[]"; } final short[] 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(); } ShortQueue();  ShortQueue(int initialSize); }
ShortQueue { public String toString () { if (size == 0) { return "[]"; } final short[] 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(); } 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 String toString () { if (size == 0) { return "[]"; } final short[] 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(); } 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; }