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