com.partnersoft.data
Class EmptyIterator<T>

java.lang.Object
  extended by com.partnersoft.data.EmptyIterator<T>
All Implemented Interfaces:
java.util.Iterator<T>

public class EmptyIterator<T>
extends java.lang.Object
implements java.util.Iterator<T>

An Iterator for nothing.

Use EmptyIterator whenever you want a non-null, but empty, Iterator. It has no state so feel free to use the standardInstance() and avoid creating a new copy.

Copyright 2003-2006 Partner Software, Inc.

Version:
$Id: EmptyIterator.java 1195 2008-02-18 22:37:30Z paul $
Author:
Paul Reavis

Constructor Summary
EmptyIterator()
          Creates an EmptyIterator.
 
Method Summary
 boolean hasNext()
          Always returns false.
 T next()
          Always throws NoSuchElementException.
 void remove()
          Always throws UnsupportedOperationException.
static EmptyIterator standardInstance()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EmptyIterator

public EmptyIterator()
Creates an EmptyIterator. All EmptyIterators are equivalent and stateless, so consider using standardInstance() instead.

Method Detail

standardInstance

public static EmptyIterator standardInstance()

hasNext

public boolean hasNext()
Always returns false.

Specified by:
hasNext in interface java.util.Iterator<T>

next

public T next()
Always throws NoSuchElementException.

Specified by:
next in interface java.util.Iterator<T>

remove

public void remove()
Always throws UnsupportedOperationException.

Specified by:
remove in interface java.util.Iterator<T>