Package org.jboss.util.collection
Class ReverseListIterator<E>
- java.lang.Object
-
- org.jboss.util.collection.ReverseListIterator<E>
-
- Type Parameters:
E
-
- All Implemented Interfaces:
java.util.Iterator<E>
public class ReverseListIterator<E> extends java.lang.Object implements java.util.Iterator<E>
An iterator that returns elements in reverse order from a list.- Version:
- $Revision$
-
-
Constructor Summary
Constructors Constructor Description ReverseListIterator(java.util.List<E> list)
Construct a ReverseListIterator for the given list.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
hasNext()
Check if there are more elements.E
next()
Get the next element.void
remove()
Remove the current element.
-
-
-
Field Detail
-
list
protected final java.util.List<E> list
The list to get elements from
-
current
protected int current
The current index of the list
-
-
Constructor Detail
-
ReverseListIterator
public ReverseListIterator(java.util.List<E> list)
Construct a ReverseListIterator for the given list.- Parameters:
list
- List to iterate over.
-
-
Method Detail
-
hasNext
public boolean hasNext()
Check if there are more elements.- Specified by:
hasNext
in interfacejava.util.Iterator<E>
- Returns:
- True if there are more elements.
-
next
public E next()
Get the next element.- Specified by:
next
in interfacejava.util.Iterator<E>
- Returns:
- The next element.
- Throws:
java.util.NoSuchElementException
-
remove
public void remove()
Remove the current element.- Specified by:
remove
in interfacejava.util.Iterator<E>
-
-