JCommon 1.0.17-redhat-2

org.jfree.util
Class ReadOnlyIterator

java.lang.Object
  extended by org.jfree.util.ReadOnlyIterator
All Implemented Interfaces:
Iterator

public class ReadOnlyIterator
extends Object
implements Iterator

Protects an given iterator by preventing calls to remove().

Author:
Thomas Morgner

Constructor Summary
ReadOnlyIterator(Iterator it)
          Creates a new read-only iterator for the given iterator.
 
Method Summary
 boolean hasNext()
          Returns true if the iteration has more elements.
 Object next()
          Returns the next element in the iteration.
 void remove()
          Throws UnsupportedOperationException.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReadOnlyIterator

public ReadOnlyIterator(Iterator it)
Creates a new read-only iterator for the given iterator.

Parameters:
it - the iterator.
Method Detail

hasNext

public boolean hasNext()
Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)

Specified by:
hasNext in interface Iterator
Returns:
true if the iterator has more elements.

next

public Object next()
Returns the next element in the iteration. Throws NoSuchElementException when iteration has no more elements.

Specified by:
next in interface Iterator
Returns:
the next element in the iteration.

remove

public void remove()
Throws UnsupportedOperationException.

Specified by:
remove in interface Iterator

JCommon 1.0.17-redhat-2

Copyright © 2001-2012 JFree.org. All Rights Reserved.