package java.util; public class Cell { public T value; public Cell next; public Cell(T value, Cell next) { this.value = value; this.next = next; } public String toString() { StringBuilder sb = new StringBuilder(); sb.append("("); for (Cell c = this; c != null; c = c.next) { sb.append(value); if (c.next != null) { sb.append(" "); } } sb.append(")"); return sb.toString(); } }