@Test public void toString1() { ListInt coll = new ListInt() { @Override public int size() { return 10; } @Override public int getInt(int index) { return index; } }; assertThat(coll.toString(), equalTo("[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]")); }
@Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("["); int i = 0; for (; i < size() - 1; i++) { builder.append(getInt(i)).append(", "); } builder.append(getInt(i)).append("]"); return builder.toString(); }
ListInt implements ListNumber, CollectionInt { @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("["); int i = 0; for (; i < size() - 1; i++) { builder.append(getInt(i)).append(", "); } builder.append(getInt(i)).append("]"); return builder.toString(); } }
ListInt implements ListNumber, CollectionInt { @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("["); int i = 0; for (; i < size() - 1; i++) { builder.append(getInt(i)).append(", "); } builder.append(getInt(i)).append("]"); return builder.toString(); }  }
ListInt implements ListNumber, CollectionInt { @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("["); int i = 0; for (; i < size() - 1; i++) { builder.append(getInt(i)).append(", "); } builder.append(getInt(i)).append("]"); return builder.toString(); }  @Override IteratorInt iterator(); @Override double getDouble(int index); @Override float getFloat(int index); @Override long getLong(int index); @Override short getShort(int index); @Override byte getByte(int index); @Override void setDouble(int index, double value); @Override void setFloat(int index, float value); @Override void setLong(int index, long value); @Override void setInt(int index, int value); @Override void setShort(int index, short value); @Override void setByte(int index, byte value); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); }
ListInt implements ListNumber, CollectionInt { @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("["); int i = 0; for (; i < size() - 1; i++) { builder.append(getInt(i)).append(", "); } builder.append(getInt(i)).append("]"); return builder.toString(); }  @Override IteratorInt iterator(); @Override double getDouble(int index); @Override float getFloat(int index); @Override long getLong(int index); @Override short getShort(int index); @Override byte getByte(int index); @Override void setDouble(int index, double value); @Override void setFloat(int index, float value); @Override void setLong(int index, long value); @Override void setInt(int index, int value); @Override void setShort(int index, short value); @Override void setByte(int index, byte value); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString();  }