Skip to content

Instantly share code, notes, and snippets.

@okram
Created May 14, 2012 22:26
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 okram/2697842 to your computer and use it in GitHub Desktop.
Save okram/2697842 to your computer and use it in GitHub Desktop.
/**
* A CloseableIterable which wraps a simple iterator.
*
* @author Joshua Shinavier (http://fortytwo.net)
*/
public class IteratorCloseableIterable<T> implements CloseableIterable<T> {
private final Iterator<T> iterator;
public IteratorCloseableIterable(Iterator<T> iterator) {
this.iterator = iterator;
}
@Override
public void close() {
// Do nothing.
}
@Override
public Iterator<T> iterator() {
return iterator;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment