code: public void clear() {
          // Clearing all of the links between nodes is "unnecessary", but:
          // - helps a generational GC if the discarded nodes inhabit
          //   more than one generation
          // - is sure to free memory even if there is a reachable Iterator
          for (Node<E> x = first; x != null; ) {
              Node<E> next = x.next;
              x.item = null;
              x.next = null;
              x.prev = null;
              x = next;
          }
          first = last = null;
          size = 0;
          modCount++;
      }
docs: Removes all of the elements from this list.
  The list will be empty after this call returns.