net.sf.jga.util

Class EmptyIterator<T>

public class EmptyIterator<T> extends Object implements ListIterator<T>

Iterator over an empty set of elements.

Author: David A. Hall

Method Summary
voidadd(T arg)
throws UnsupportedOperationException
booleanhasNext()
Returns false: the set of elements is empty by definition
booleanhasPrevious()
Returns false: the set of elements is empty by definition
Tnext()
throws NoSuchElement exception
intnextIndex()
returns the size of the list (0, in this case)
Tprevious()
throws NoSuchElement exception
intpreviousIndex()
returns -1, as there is no previous
voidremove()
throws UnsupportedOperationException
voidset(T arg)
throws UnsupportedOperationException

Method Detail

add

public void add(T arg)
throws UnsupportedOperationException

hasNext

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

Returns: false

hasPrevious

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

Returns: false

next

public T next()
throws NoSuchElement exception

Returns: nothing

nextIndex

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

Returns: 0

previous

public T previous()
throws NoSuchElement exception

Returns: nothing

previousIndex

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

Returns: -1;

remove

public void remove()
throws UnsupportedOperationException

set

public void set(T arg)
throws UnsupportedOperationException