@Test public void testIterable(){ MyIterableLinkedList<String> data = new MyIterableLinkedList<>(); data.add("a"); data.add("b"); data.add("c"); String buffer = ""; for(String value : data){ buffer += value; } assertEquals("abc", buffer); }
public void add(T value) { ListNode node = new ListNode(); node.value = value; size++; modificationCounter++; if (head == null) { head = node; tail = node; return; } tail.next = node; tail = node; }
MyIterableLinkedList implements Iterable<T> { public void add(T value) { ListNode node = new ListNode(); node.value = value; size++; modificationCounter++; if (head == null) { head = node; tail = node; return; } tail.next = node; tail = node; } }
MyIterableLinkedList implements Iterable<T> { public void add(T value) { ListNode node = new ListNode(); node.value = value; size++; modificationCounter++; if (head == null) { head = node; tail = node; return; } tail.next = node; tail = node; }  }
MyIterableLinkedList implements Iterable<T> { public void add(T value) { ListNode node = new ListNode(); node.value = value; size++; modificationCounter++; if (head == null) { head = node; tail = node; return; } tail.next = node; tail = node; }  @Override Iterator<T> iterator(); void delete(int index); T get(int index); void add(T value); int size(); boolean isEmpty(); boolean contains(T value); }
MyIterableLinkedList implements Iterable<T> { public void add(T value) { ListNode node = new ListNode(); node.value = value; size++; modificationCounter++; if (head == null) { head = node; tail = node; return; } tail.next = node; tail = node; }  @Override Iterator<T> iterator(); void delete(int index); T get(int index); void add(T value); int size(); boolean isEmpty(); boolean contains(T value);  }