code: public static <T> Enumeration<T> asEnumeration(final Iterator<T> iterator) {
      checkNotNull(iterator);
      return new Enumeration<T>() {
        @Override
        public boolean hasMoreElements() {
          return iterator.hasNext();
        }
  
        @Override
        public T nextElement() {
          return iterator.next();
        }
      };
    }
docs: Adapts an {@code Iterator} to the {@code Enumeration} interface.
  
  <p>The {@code Iterable} equivalent of this method is either {@link Collections#enumeration} (if
  you have a {@link Collection}), or {@code Iterators.asEnumeration(collection.iterator())}.