Package org.eclipse.xtext.nodemodel.util
Class EmptyBidiIterable<T>
- java.lang.Object
-
- org.eclipse.xtext.nodemodel.util.EmptyBidiIterable<T>
-
- All Implemented Interfaces:
java.lang.Iterable<T>
,BidiIterable<T>
public class EmptyBidiIterable<T> extends java.lang.Object implements BidiIterable<T>
-
-
Constructor Summary
Constructors Constructor Description EmptyBidiIterable()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> EmptyBidiIterable<T>
instance()
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
-
instance
public static <T> EmptyBidiIterable<T> instance()
-
iterator
public BidiIterator<T> iterator()
Description copied from interface:BidiIterable
Returns an iterator that can be used forwards and backwards.- Specified by:
iterator
in interfaceBidiIterable<T>
- Specified by:
iterator
in interfacejava.lang.Iterable<T>
- Returns:
- an iterator. Never returns
null
.
-
reverse
public BidiIterable<T> reverse()
Description copied from interface: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()
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 }
- Specified by:
reverse
in interfaceBidiIterable<T>
- Returns:
- the reversed iterable. Never returns
null
.
-
-