public class NodeIterable extends java.lang.Object implements BidiIterable<INode>
Constructor and Description |
---|
NodeIterable(INode startWith) |
Modifier and Type | Method and Description |
---|---|
BidiIterator<INode> |
iterator()
Returns an iterator that can be used forwards and backwards.
|
BidiIterable<INode> |
reverse()
Returns a reverse version of this iterable that can be used
forwards and backwards.
|
public NodeIterable(INode startWith)
public BidiIterator<INode> iterator()
BidiIterable
iterator
in interface java.lang.Iterable<INode>
iterator
in interface BidiIterable<INode>
null
.public BidiIterable<INode> reverse()
BidiIterable
Returns a reverse version of this iterable that can be used
forwards and backwards. In other words, an iterator provided by
the reverse iterable will delegate its hasNext()
and next()
invocations to
BidiIterator.hasPrevious()
and BidiIterator.previous()
respectively.
This allows clients to iterate backwards by means of the enhanced for-loop:
for(T t: iterable.reverse()) { // do something with t }
reverse
in interface BidiIterable<INode>
null
.