net.sf.staccatocommons.iterators
Class EmptyThriterator<T>
java.lang.Object
net.sf.staccatocommons.iterators.AbstractUnmodifiableIterator<A>
net.sf.staccatocommons.iterators.thriter.AbstractThriterator<T>
net.sf.staccatocommons.iterators.EmptyThriterator<T>
- Type Parameters:
T - the element type
- All Implemented Interfaces:
- Iterator<T>, EmptyAware, Thriter<T>, Thriterator<T>
public final class EmptyThriterator<T>
- extends AbstractThriterator<T>
An iterator that retrieves no elements. Calling hasNext() will
always return false, and calling next() will throw a
NoSuchElementException
- Author:
- flbulgarelli
EmptyThriterator
public EmptyThriterator()
hasNext
public boolean hasNext()
- Description copied from interface:
Thriter
- Answers if the thriter has more elements, that is, if sending
Thriter.advanceNext() would not result in a NoSuchElementException
- Returns:
- if the
Thriter has more elements
next
public T next()
advanceNext
public void advanceNext()
throws NoSuchElementException
- Description copied from interface:
Thriter
- Advances to the thriter to the position of the next element.
- Throws:
NoSuchElementException - if there are no more elements
current
public T current()
throws NoSuchElementException
- Description copied from interface:
Thriter
- Answers element at the current position of this
Thriter. Result of
this method if Thriter.advanceNext() was never evaluated before is
undefined.
- Returns:
- the current element
- Throws:
NoSuchElementException
empty
@Constant
public static <T> Thriterator<T> empty()
- Type Parameters:
T - the type of the iterator element
- Returns:
- the singleton instance
toString
public String toString()
- Overrides:
toString in class Object