@Test public void testInit() { assertEquals("[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]", l.toString()); int i = 1; for(String s : l) { assertEquals(Integer.toString(i), s); i++; } }
@Override public String toString() { if(head == null) return "#epsilon"; StringBuilder sb = new StringBuilder("["); Node node = head; while(node != null) { sb.append(node.element.toString()); sb.append(", "); node = node.next; } String ret = sb.substring(0, sb.length() - 2); return ret + "]"; }
SinglyLinkedList implements Iterable<E> { @Override public String toString() { if(head == null) return "#epsilon"; StringBuilder sb = new StringBuilder("["); Node node = head; while(node != null) { sb.append(node.element.toString()); sb.append(", "); node = node.next; } String ret = sb.substring(0, sb.length() - 2); return ret + "]"; } }
SinglyLinkedList implements Iterable<E> { @Override public String toString() { if(head == null) return "#epsilon"; StringBuilder sb = new StringBuilder("["); Node node = head; while(node != null) { sb.append(node.element.toString()); sb.append(", "); node = node.next; } String ret = sb.substring(0, sb.length() - 2); return ret + "]"; } SinglyLinkedList();  SinglyLinkedList(Iterable<E> c); }
SinglyLinkedList implements Iterable<E> { @Override public String toString() { if(head == null) return "#epsilon"; StringBuilder sb = new StringBuilder("["); Node node = head; while(node != null) { sb.append(node.element.toString()); sb.append(", "); node = node.next; } String ret = sb.substring(0, sb.length() - 2); return ret + "]"; } SinglyLinkedList();  SinglyLinkedList(Iterable<E> c); boolean add(E e); boolean addAll(Iterable<E> c); boolean contains(Object o); @Override boolean equals(Object o); @Override int hashCode(); boolean isEmpty(); boolean remove(Object o); int size(); void replace(Iterator<E> I, Iterator<E> J, SinglyLinkedList<E> replacement); void nonDestructiveReplace(Iterator<E> I, Iterator<E> J, Iterable<E> replacement); void printRange(Iterator<E> I, Iterator<E> J); @Override String toString(); @Override Iterator<E> iterator(); Iterator<E> iterator(Iterator<E> I); Node getHead(); Node getTail(); }
SinglyLinkedList implements Iterable<E> { @Override public String toString() { if(head == null) return "#epsilon"; StringBuilder sb = new StringBuilder("["); Node node = head; while(node != null) { sb.append(node.element.toString()); sb.append(", "); node = node.next; } String ret = sb.substring(0, sb.length() - 2); return ret + "]"; } SinglyLinkedList();  SinglyLinkedList(Iterable<E> c); boolean add(E e); boolean addAll(Iterable<E> c); boolean contains(Object o); @Override boolean equals(Object o); @Override int hashCode(); boolean isEmpty(); boolean remove(Object o); int size(); void replace(Iterator<E> I, Iterator<E> J, SinglyLinkedList<E> replacement); void nonDestructiveReplace(Iterator<E> I, Iterator<E> J, Iterable<E> replacement); void printRange(Iterator<E> I, Iterator<E> J); @Override String toString(); @Override Iterator<E> iterator(); Iterator<E> iterator(Iterator<E> I); Node getHead(); Node getTail();  }