edu.stanford.nlp.util
Class IterableIterator<E>
java.lang.Object
edu.stanford.nlp.util.IterableIterator<E>
- All Implemented Interfaces:
- Iterable<E>, Iterator<E>
public class IterableIterator<E>
- extends Object
- implements Iterator<E>, Iterable<E>
This cures a pet peeve of mine: that you can't use an Iterator directly in
Java 5's foreach construct. Well, this one you can, dammit.
- Author:
- Bill MacCartney
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
IterableIterator
public IterableIterator(Iterator<E> it)
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interface Iterator<E>
next
public E next()
- Specified by:
next
in interface Iterator<E>
remove
public void remove()
- Specified by:
remove
in interface Iterator<E>
iterator
public Iterator<E> iterator()
- Specified by:
iterator
in interface Iterable<E>
main
public static void main(String[] args)
Stanford NLP Group