code: public void clear() {
          Iterator<E> it = iterator();
          while (it.hasNext()) {
              it.next();
              it.remove();
          }
      }
docs: {@inheritDoc}
  
  <p>This implementation iterates over this collection, removing each
  element using the <tt>Iterator.remove</tt> operation.  Most
  implementations will probably choose to override this method for
  efficiency.
  
  <p>Note that this implementation will throw an
  <tt>UnsupportedOperationException</tt> if the iterator returned by this
  collection's <tt>iterator</tt> method does not implement the
  <tt>remove</tt> method and this collection is non-empty.
  
  @throws UnsupportedOperationException {@inheritDoc}