Package org.eclipse.xtext.nodemodel
Interface BidiIterable<T>
-
- All Superinterfaces:
java.lang.Iterable<T>
- All Known Subinterfaces:
BidiTreeIterable<E>
- All Known Implementing Classes:
AbstractNode,BasicNodeIterable,CompositeNode,CompositeNodeWithSemanticElement,CompositeNodeWithSemanticElementAndSyntaxError,CompositeNodeWithSyntaxError,EmptyBidiIterable,HiddenLeafNode,HiddenLeafNodeWithSyntaxError,LeafNode,LeafNodeWithSyntaxError,NodeIterable,ReversedBidiIterable,ReversedBidiTreeIterable,RootNode,SingletonBidiIterable,SyntheticCompositeNode
public interface BidiIterable<T> extends java.lang.Iterable<T>An iterable that is capable of being iterated in both directions - forwards and backwards.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description BidiIterator<T>iterator()Returns an iterator that can be used forwards and backwards.BidiIterable<T>reverse()Returns a reverse version of this iterable that can be used forwards and backwards.
-
-
-
Method Detail
-
iterator
BidiIterator<T> iterator()
Returns an iterator that can be used forwards and backwards.- Specified by:
iteratorin interfacejava.lang.Iterable<T>- Returns:
- an iterator. Never returns
null.
-
reverse
BidiIterable<T> reverse()
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()andnext()invocations toBidiIterator.hasPrevious()andBidiIterator.previous()respectively.This allows clients to iterate backwards by means of the enhanced for-loop:
for(T t: iterable.reverse()) { // do something with t }- Returns:
- the reversed iterable. Never returns
null.
-
-