Package diva.util

Class ReverseIterator

  • All Implemented Interfaces:
    java.util.Iterator

    public class ReverseIterator
    extends IteratorAdapter
    A reverse-order iterator over a List.
    Version:
    $Id$
    Author:
    John Reekie
    • Constructor Summary

      Constructors 
      Constructor Description
      ReverseIterator​(java.util.List list)
      Construct a reverse iterator on the given list.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean hasNext()
      Test if there are more elements.
      java.lang.Object next()
      Return the next element.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Iterator

        forEachRemaining
    • Constructor Detail

      • ReverseIterator

        public ReverseIterator​(java.util.List list)
        Construct a reverse iterator on the given list.
        Parameters:
        list - The list with which to construct the iterator.
    • Method Detail

      • hasNext

        public boolean hasNext()
        Test if there are more elements.
        Specified by:
        hasNext in interface java.util.Iterator
        Overrides:
        hasNext in class IteratorAdapter
        Returns:
        true if there more elements.
      • next

        public java.lang.Object next()
                              throws java.util.NoSuchElementException
        Return the next element.
        Specified by:
        next in interface java.util.Iterator
        Overrides:
        next in class IteratorAdapter
        Returns:
        the next element.
        Throws:
        java.util.NoSuchElementException - If the element does not exist.