org.eclipse.xtext.nodemodel
Interface BidiIterator<T>

All Superinterfaces:
java.util.Iterator<T>
All Known Subinterfaces:
BidiTreeIterator<T>
All Known Implementing Classes:
BasicNodeIterator, BasicNodeTreeIterator, EmptyBidiIterator, NodeIterator, NodeTreeIterator, ReversedBidiIterator, ReversedBidiTreeIterator, SingletonBidiIterator

public interface BidiIterator<T>
extends java.util.Iterator<T>

A bidirectional iterator. It can be used in both directions and even alternating.

It is similar to a ListIterator besides that it does not support the index-based operations previousIndex and nextIndex or the mutating operations set and add.

Author:
Sebastian Zarnekow - Initial contribution and API

Method Summary
 boolean hasPrevious()
          Returns true if this bidi iterator has more elements when traversing in the reverse direction.
 T previous()
          Returns the previous element.
 
Methods inherited from interface java.util.Iterator
hasNext, next, remove
 

Method Detail

hasPrevious

boolean hasPrevious()
Returns true if this bidi iterator has more elements when traversing in the reverse direction. (In other words, returns true if previous would return an element rather than throwing an exception.)

Returns:
true if the bidi iterator has more elements when traversing in the reverse direction.

previous

T previous()
Returns the previous element. This method may be called repeatedly to iterate backwards, or intermixed with calls to next to go back and forth. (Note that alternating calls to next and previous will return the same element repeatedly.)

Returns:
the previous element.
Throws:
java.util.NoSuchElementException - if the iteration has no previous element.