net.sf.jga.util
Class EmptyIterator<T>

java.lang.Object
  extended by net.sf.jga.util.EmptyIterator<T>
All Implemented Interfaces:
java.lang.Iterable<T>, java.util.Iterator<T>, java.util.ListIterator<T>

public class EmptyIterator<T>
extends java.lang.Object
implements java.util.ListIterator<T>, java.lang.Iterable<T>

Iterator over an empty set of elements.

Author:
David A. Hall

Constructor Summary
EmptyIterator()
           
 
Method Summary
 void add(T arg)
          throws UnsupportedOperationException
 boolean hasNext()
          Returns false: the set of elements is empty by definition
 boolean hasPrevious()
          Returns false: the set of elements is empty by definition
 java.util.Iterator<T> iterator()
           
 T next()
          throws NoSuchElement exception
 int nextIndex()
          returns the size of the list (0, in this case)
 T previous()
          throws NoSuchElement exception
 int previousIndex()
          returns -1, as there is no previous
 void remove()
          throws UnsupportedOperationException
 void set(T arg)
          throws UnsupportedOperationException
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EmptyIterator

public EmptyIterator()
Method Detail

iterator

public java.util.Iterator<T> iterator()
Specified by:
iterator in interface java.lang.Iterable<T>

hasNext

public boolean hasNext()
Returns false: the set of elements is empty by definition

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

next

public T next()
throws NoSuchElement exception

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

hasPrevious

public boolean hasPrevious()
Returns false: the set of elements is empty by definition

Specified by:
hasPrevious in interface java.util.ListIterator<T>
Returns:
false

previous

public T previous()
throws NoSuchElement exception

Specified by:
previous in interface java.util.ListIterator<T>
Returns:
nothing

nextIndex

public int nextIndex()
returns the size of the list (0, in this case)

Specified by:
nextIndex in interface java.util.ListIterator<T>
Returns:
0

previousIndex

public int previousIndex()
returns -1, as there is no previous

Specified by:
previousIndex in interface java.util.ListIterator<T>
Returns:
-1;

remove

public void remove()
throws UnsupportedOperationException

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

set

public void set(T arg)
throws UnsupportedOperationException

Specified by:
set in interface java.util.ListIterator<T>

add

public void add(T arg)
throws UnsupportedOperationException

Specified by:
add in interface java.util.ListIterator<T>


Copyright © 2002-2006 David A. Hall. All Rights Reserved.