JUtil

net.cscott.jutil
Class ReverseIterator<E>

java.lang.Object
  extended by net.cscott.jutil.UnmodifiableIterator<E>
      extended by net.cscott.jutil.SnapshotIterator<E>
          extended by 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

Constructor Summary
ReverseIterator(Iterator<E> it)
          Creates a ReverseIterator of Iterator it.
 
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 net.cscott.jutil.UnmodifiableIterator
proxy, remove
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReverseIterator

public ReverseIterator(Iterator<E> it)
Creates a ReverseIterator of Iterator it.

Method Detail

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>

JUtil

Copyright (c) 2006 C. Scott Ananian