code: @NullSafe
    public static <T> Enumeration<T> asEnumeration(Iterator<T> iterator) {
  
      return (iterator == null ? Collections.emptyEnumeration() : new Enumeration<T>() {
  
        @Override
        public boolean hasMoreElements() {
          return iterator.hasNext();
        }
  
        @Override
        public T nextElement() {
          return iterator.next();
        }
      });
    }
docs: Adapts the {@link Iterator} into an instance of the {@link Enumeration} interface.
  Returns an empty {@link Enumeration} if the {@link Iterator} is null.
  
  @param <T> Class type of the elements in the {@link Iterator}.
  @param iterator {@link Iterator} to adapt into an {@link Enumeration}.
  @return an {@link Enumeration} implementation enumerating over the elements in the {@link Iterator}.
  @see java.util.Collections#emptyEnumeration()
  @see #asIterator(java.util.Enumeration)
  @see java.util.Enumeration
  @see java.util.Iterator