public static < T > Iterable < T > singleTimeIterable ( Enumeration < T > enumeration ) { return new Iterable < T > ( ) { @ Override public Iterator < T > iterator ( ) { return CollectionsUtil . iterator ( enumeration ) ; } } ; }
Create an Iterable from an Enumeration but avoiding to create a list so the Iterable can be iterated only once .