code: public Iterator<A> iterator() {
          return new Iterator<A>() {
              List<A> elems = ListBuffer.this.elems;
              public boolean hasNext() {
                  return !elems.isEmpty();
              }
              public A next() {
                  if (elems.isEmpty())
                      throw new NoSuchElementException();
                  A elem = elems.head;
                  elems = elems.tail;
                  return elem;
              }
              public void remove() {
                  throw new UnsupportedOperationException();
              }
          };
      }
docs: An enumeration of all elements in this buffer.