boolean (Object o) { if (o == this) { return true; } if (!(o instanceof List)) { return false; } ListIterator<E> e1 = listIterator(); //noinspection unchecked ListIterator<E> e2 = ((List<E>)o).listIterator(); while (e1.hasNext() && e2.hasNext()) { E o1 = e1.next(); E o2 = e2.next(); if (!Objects.equals(o1, o2)) { return false; } } return !(e1.hasNext() || e2.hasNext()); }