Packagecom.boostworthy.collections.iterators
Classpublic class NullIterator
ImplementsIIterator

In certain cases, such as a leaf object in a composite pattern, a null iterator is needed to maintain elegant code. Instead of making special checks using if statements, a null iterator will plug right into a loop and return 'false' when 'HasNext' is checked.

See also

hasNext
com.boostworthy.collections.iterators.IIterator


Public Methods
 MethodDefined by
  
Constructor.
NullIterator
  
hasNext():Boolean
Returns a boolean value indicating whether or not the collection has another element beyond the current index.
NullIterator
  
next():Object
Returns the element at the current index and then moves on to the next.
NullIterator
  
reset():void
Resets this iterator back to it's starting index.
NullIterator
Constructor detail
NullIterator()constructor
public function NullIterator()

Constructor.

Method detail
hasNext()method
public function hasNext():Boolean

Returns a boolean value indicating whether or not the collection has another element beyond the current index.

Returns
Boolean — A boolean value indicating whether or not the collection has another element beyond the current index.
next()method 
public function next():Object

Returns the element at the current index and then moves on to the next.

Returns
Object — The element at the current index.
reset()method 
public function reset():void

Resets this iterator back to it's starting index.

NOTE: This method is only present to meet the criteria of the 'IIterator' interface.

See also