code: private void copy() {
          if (elems.nonEmpty()) {
              List<A> orig = elems;
  
              elems = last = List.of(orig.head);
  
              while ((orig = orig.tail).nonEmpty()) {
                  last.tail = List.of(orig.head);
                  last = last.tail;
              }
          }
      }
docs: Copy list and sets last.