public static < T > Enumeration < T > enumeration ( final Collection < T > c ) { return new Enumeration < T > ( ) { private final Iterator < T > i = c . iterator ( ) ; public boolean hasMoreElements ( ) { return i . hasNext ( ) ; } public T nextElement ( ) { return i . next ( ) ; } } ; }
Returns an enumeration over the specified collection . This provides interoperability with legacy APIs that require an enumeration as input .