### Question:
SingleLinkedList implements Iterable<E>, Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } SingleLinkedList<?> other = (SingleLinkedList<?>) obj; Node<E> thisNode = head; Node<?> thatNode = other.head; while (true) { if (thisNode == null) { return thatNode == null; } else if (thatNode == null) { return false; } else { if (thisNode.value == null) { return thatNode.value == null; } if (thisNode.value.equals(thatNode.value) == false) { return false; } thisNode = thisNode.next; thatNode = thatNode.next; } } } 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 equals() { { SingleLinkedList<?> a = new SingleLinkedList<>(Collections.emptyList()); SingleLinkedList<?> b = new SingleLinkedList<>(Collections.emptyList()); assertTrue(a.equals(b)); assertTrue(b.equals(a)); } { SingleLinkedList<?> a = new SingleLinkedList<>(Arrays.asList("a")); SingleLinkedList<?> b = new SingleLinkedList<>(Collections.emptyList()); assertFalse(a.equals(b)); assertFalse(b.equals(a)); } { SingleLinkedList<?> a = new SingleLinkedList<>(Arrays.asList("a")); SingleLinkedList<?> b = new SingleLinkedList<>(Arrays.asList("a")); assertTrue(a.equals(b)); assertTrue(b.equals(a)); } { SingleLinkedList<?> a = new SingleLinkedList<>(Arrays.asList("a")); SingleLinkedList<?> b = new SingleLinkedList<>(Arrays.asList("b")); assertFalse(a.equals(b)); assertFalse(b.equals(a)); } { SingleLinkedList<?> a = new SingleLinkedList<>(Arrays.asList("a", "b")); SingleLinkedList<?> b = new SingleLinkedList<>(Arrays.asList("b")); assertFalse(a.equals(b)); assertFalse(b.equals(a)); } { SingleLinkedList<?> a = new SingleLinkedList<>(Arrays.asList("a", "b")); SingleLinkedList<?> b = new SingleLinkedList<>(Arrays.asList("a", "b")); assertTrue(a.equals(b)); assertTrue(b.equals(a)); } { SingleLinkedList<?> a = new SingleLinkedList<>(Arrays.asList("a", "b", "c")); SingleLinkedList<?> b = new SingleLinkedList<>(Arrays.asList("a", "b")); assertFalse(a.equals(b)); assertFalse(b.equals(a)); } { SingleLinkedList<?> a = new SingleLinkedList<>(Arrays.asList("a", "b", "c")); SingleLinkedList<?> b = new SingleLinkedList<>(Arrays.asList("a", "b", "c")); assertTrue(a.equals(b)); assertTrue(b.equals(a)); } }