JBoss Common Classes 2.2.17.GA

org.jboss.util.collection
Class ReverseListIterator<E>

java.lang.Object
  extended by org.jboss.util.collection.ReverseListIterator<E>
Type Parameters:
E -
All Implemented Interfaces:
Iterator<E>

public class ReverseListIterator<E>
extends Object
implements Iterator<E>

An iterator that returns elements in reverse order from a list.

Version:
$Revision: 2787 $
Author:
Jason Dillon

Field Summary
protected  int current
          The current index of the list
protected  List<E> list
          The list to get elements from
 
Constructor Summary
ReverseListIterator(List<E> list)
          Construct a ReverseListIterator for the given list.
 
Method Summary
 boolean hasNext()
          Check if there are more elements.
 E next()
          Get the next element.
 void remove()
          Remove the current element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

list

protected final List<E> list
The list to get elements from


current

protected int current
The current index of the list

Constructor Detail

ReverseListIterator

public ReverseListIterator(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 interface Iterator<E>
Returns:
True if there are more elements.

next

public E next()
Get the next element.

Specified by:
next in interface Iterator<E>
Returns:
The next element.
Throws:
NoSuchElementException

remove

public void remove()
Remove the current element.

Specified by:
remove in interface Iterator<E>

JBoss Common Classes 2.2.17.GA

Copyright © 2011 JBoss, a division of Red Hat, Inc.. All Rights Reserved.