/** * Created on 2006-12-13 */ import java.util.Iterator; import java.util.NoSuchElementException; /** * Iterator fuer eine SimpleList * * @author Frank Blendinger (fb@intoxicatedmind.net) * * @param Typarameter * */ public final class SimpleListIterator implements Iterator { private SimpleListElem cur; public SimpleListIterator(SimpleListElem first) { this.cur = first; } public boolean hasNext() { return (cur != null); } public T next() { if (cur == null) { throw new NoSuchElementException("no more elements"); } T ret = cur.getData(); cur = cur.getNext(); return ret; } public void remove() { throw new UnsupportedOperationException(); } }