public static < E > Iterable < E > iterable ( final Enumeration < E > enumeration ) { checkNotNull ( enumeration , "Can not create an Iterable from a null enumeration" ) ; return new Iterable < E > ( ) { public Iterator < E > iterator ( ) { return new ImmutableIterator < E > ( ) { public boolean hasNext ( ) { return enumeration . hasMoreElements ( ) ; } public E next ( ) { return enumeration . nextElement ( ) ; } } ; } } ; }
Convert an enumeration to an iterator .