net.cscott.jutil
Class ReverseIterator<E>
java.lang.Object
net.cscott.jutil.UnmodifiableIterator<E>
net.cscott.jutil.SnapshotIterator<E>
net.cscott.jutil.ReverseIterator<E>
- All Implemented Interfaces:
- Iterator<E>
public class ReverseIterator<E>
- extends SnapshotIterator<E>
A ReverseIterator
iterates through an Iterator
in reverse order. It extends SnapshotIterator
, so is
insensitive to changes in the underlying collection once construction
is complete.
- Version:
- $Id: ReverseIterator.java,v 1.3 2006-10-30 19:58:06 cananian Exp $
- Author:
- C. Scott Ananian
Method Summary |
boolean |
hasNext()
Returns true if the iteration has more elements. |
E |
next()
Returns the next element in the iteration. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ReverseIterator
public ReverseIterator(Iterator<E> it)
- Creates a
ReverseIterator
of Iterator
it
.
hasNext
public boolean hasNext()
- Description copied from class:
UnmodifiableIterator
- Returns
true
if the iteration has more elements.
- Specified by:
hasNext
in interface Iterator<E>
- Overrides:
hasNext
in class SnapshotIterator<E>
- Returns:
true
if the iterator has more elements.
next
public E next()
- Description copied from class:
UnmodifiableIterator
- Returns the next element in the iteration.
- Specified by:
next
in interface Iterator<E>
- Overrides:
next
in class SnapshotIterator<E>
Copyright (c) 2006 C. Scott Ananian