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.
hasNext, com.boostworthy.collections.iterators.IIterator
NullIterator | In certain cases, such as a leaf object in a composite pattern, a null iterator is needed to maintain elegant code. |
Functions | |
NullIterator | Constructor. |
hasNext | Returns a boolean value indicating whether or not the collection has another element beyond the current index. |
next | Returns the element at the current index and then moves on to the next. |
reset | Resets this iterator back to it’s starting index. |
Constructor.
public function NullIterator()
Returns a boolean value indicating whether or not the collection has another element beyond the current index.
public function hasNext():Boolean
Returns the element at the current index and then moves on to the next.
public function next():Object
Resets this iterator back to it’s starting index.
public function reset():void