### Question:
SingleLinkedList implements Iterable<E>, Serializable { @Override public Iterator<E> iterator() { return new NodeIterator<>(head); } SingleLinkedList();  SingleLinkedList(List<? extends E> list);  SingleLinkedList(Iterable<? extends E> iterable); private  SingleLinkedList(Node<E> head); boolean isEmpty(); int size(); SingleLinkedList<E> concat(E element); E first(); SingleLinkedList<E> rest(); E get(int index); @Override Iterator<E> iterator(); C fill(C target); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }### Answer:
@Test public void iterator() { { List<String> from = Arrays.asList("a", "b", "c"); SingleLinkedList<String> list = new SingleLinkedList<>(from); Iterator<String> iter = list.iterator(); assertTrue(iter.hasNext()); assertThat(iter.next(), is("a")); assertTrue(iter.hasNext()); assertThat(iter.next(), is("b")); assertTrue(iter.hasNext()); assertThat(iter.next(), is("c")); assertFalse(iter.hasNext()); try { iter.next(); fail(); } catch (NoSuchElementException e) { } } { SingleLinkedList<String> list = new SingleLinkedList<>(); Iterator<String> iter = list.iterator(); assertFalse(iter.hasNext()); try { iter.next(); fail(); } catch (NoSuchElementException e) { } } }