net.sf.staccatocommons.iterators
Class EmptyThriterator<T>

java.lang.Object
  extended by net.sf.staccatocommons.iterators.AbstractUnmodifiableIterator<A>
      extended by net.sf.staccatocommons.iterators.thriter.AbstractThriterator<T>
          extended by 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

Constructor Summary
EmptyThriterator()
           
 
Method Summary
 void advanceNext()
          Advances to the thriter to the position of the next element.
 T current()
          Answers element at the current position of this Thriter.
static
<T> Thriterator<T>
empty()
           
 boolean hasNext()
          Answers if the thriter has more elements, that is, if sending Thriter.advanceNext() would not result in a NoSuchElementException
 T next()
           
 String toString()
           
 
Methods inherited from class net.sf.staccatocommons.iterators.thriter.AbstractThriterator
delayedCurrent, delayedNext, isEmpty
 
Methods inherited from class net.sf.staccatocommons.iterators.AbstractUnmodifiableIterator
remove
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Iterator
remove
 

Constructor Detail

EmptyThriterator

public EmptyThriterator()
Method Detail

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


Get Staccatocommons at SourceForge.net. Fast, secure and Free Open Source software downloads