Skip to content

Instantly share code, notes, and snippets.

@benhardy
Created November 12, 2014 00:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benhardy/85e4c3f3440a9cc44ea6 to your computer and use it in GitHub Desktop.
Save benhardy/85e4c3f3440a9cc44ea6 to your computer and use it in GitHub Desktop.
Gack.
public static <T> Iterable<T> asIterable(final Enumeration<T> anotherHorribleEnumeration) {
return () -> new Iterator<T>() {
@Override
public boolean hasNext() {
return anotherHorribleEnumeration.hasMoreElements();
}
@Override
public T next() {
return anotherHorribleEnumeration.nextElement();
}
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment