nz.ac.waikato.jdsl.core.api
Interface ObjectIterator
- All Known Subinterfaces:
- EdgeIterator, LocatorIterator, PositionIterator, VertexIterator
- All Known Implementing Classes:
- AbstractGraph.OO_to_O_MergerIterator, ArrayLocatorIterator, ArrayObjectIterator, ArrayPositionIterator, EdgeIteratorAdapter, InOrderIterator, PostOrderIterator, PreOrderIterator, VertexIteratorAdapter
public interface ObjectIterator
Iterator over a set of objects. No order of the objects is required
by this interface, although order may be promised or required
by users of the interface. Conceptually, the iterator starts out
positioned before the first object to be considered. With each call
to next(), the iterator skips over another object and returns the object
skipped over, until the iterator is positioned after the last object.
Note that NoSuchElementException indicates two different failure
states: when the iterator is positioned before the first object, object()
fails; when the iterator is positioned after the last
object, next() fails.
- Version:
- JDSL 2.1.1
- Author:
- Mark Handy
Method Summary |
boolean |
hasNext()
|
java.lang.Object |
nextObject()
|
java.lang.Object |
object()
|
void |
reset()
Puts the iterator back in its initial, before-the-first state |
hasNext
boolean hasNext()
- Returns:
- Whether there is at least one object still unseen
nextObject
java.lang.Object nextObject()
throws java.util.NoSuchElementException
- Returns:
- Next object to consider
- Throws:
java.util.NoSuchElementException
- if iterator has moved past
the last object
object
java.lang.Object object()
throws java.util.NoSuchElementException
- Returns:
- The object returned by the most recent next()
- Throws:
java.util.NoSuchElementException
- When the iterator is in its
initial, before-the-first-object state
reset
void reset()
- Puts the iterator back in its initial, before-the-first state
Copyright © 2009 ModelJUnit Project. All Rights Reserved.