class Node { E data; Node next; public Node(E data, Node next) { this.data = data; this.next = next; } public Node(E data) { this(data, null); } public String toString() { if (next == null) { return data.toString(); } else { return data.toString() + ", " + next.toString(); } } }