blackboard.base
Class NullIterator

java.lang.Object
  extended by blackboard.base.NullIterator
All Implemented Interfaces:
java.util.Iterator

public class NullIterator
extends java.lang.Object
implements java.util.Iterator

A "null" implementation of the Iterator interface. Basically, this is an iterator that never actually iterates. Instead it simulates iterating over an empty list by always returning false from hasNext().

Since:
Bb 6.0.14
Version:
$Revision: #1 $ $Date: 2005/06/27 $

Method Summary
static NullIterator getInstance()
          Returns a NullIterator instance.
 boolean hasNext()
          Since there is nothing to iterate over, there is never a "next" item, and this method always returns false.
 java.lang.Object next()
          Since there is nothing to iterate over, this method always returns null.
 void remove()
          This method does nothing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static NullIterator getInstance()
Returns a NullIterator instance. Since there isn't much point in having lot of instances of a "null" object (an object that does nothing) floating around, this method always returns the same instance.

Returns:
an instance of the NullIterator.

hasNext

public boolean hasNext()
Since there is nothing to iterate over, there is never a "next" item, and this method always returns false.

Specified by:
hasNext in interface java.util.Iterator
Returns:
this method always returns false.

next

public java.lang.Object next()
Since there is nothing to iterate over, this method always returns null.

Specified by:
next in interface java.util.Iterator
Returns:
this method always returns null.

remove

public void remove()
This method does nothing.

Specified by:
remove in interface java.util.Iterator


Copyright © 2003 Blackboard, Inc. All Rights Reserved.