NullIterator

NullIterator

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

Summary
NullIteratorIn certain cases, such as a leaf object in a composite pattern, a null iterator is needed to maintain elegant code.
Functions
NullIteratorConstructor.
hasNextReturns a boolean value indicating whether or not the collection has another element beyond the current index.
nextReturns the element at the current index and then moves on to the next.
resetResets this iterator back to it’s starting index.

Functions

NullIterator

public function NullIterator()

Constructor.

hasNext

public function hasNext():Boolean

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

Returns

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

next

public function next():Object

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

Returns

The element at the current index. 

reset

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

com.boostworthy.collections.iterators.IIterator

The ‘IIterator’ interface defines a common interface for all iterator objects.
A ‘java-style’ iterator interface.
public function NullIterator()
Constructor.
public function hasNext():Boolean
Returns a boolean value indicating whether or not the collection has another element beyond the current index.
public function next():Object
Returns the element at the current index and then moves on to the next.
public function reset():void
Resets this iterator back to it’s starting index.
Close