gov.usda.gdpc.util
Class ReadOnlyIterator

java.lang.Object
  extended bygov.usda.gdpc.util.ReadOnlyIterator
All Implemented Interfaces:
java.util.Iterator

public class ReadOnlyIterator
extends java.lang.Object
implements java.util.Iterator

ReadOnlyIterator wraps the behavior of the Iterator Class to prevent ability to modify data.


Constructor Summary
ReadOnlyIterator(java.util.Iterator itr)
          ReadOnlyIterator constructor.
 
Method Summary
 boolean hasNext()
          Returns true if the iteration has more elements.
 java.lang.Object next()
          Returns the next element in the interation.
 void remove()
          Remove operation is not supported by this iterator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReadOnlyIterator

public ReadOnlyIterator(java.util.Iterator itr)
ReadOnlyIterator constructor.

Parameters:
itr - the iterator to be wrapped.
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 java.util.Iterator
Returns:
true if the iterator has more elements.

next

public java.lang.Object next()
Returns the next element in the interation.

Specified by:
next in interface java.util.Iterator
Returns:
the next element in the interation.
Throws:
NoSuchElementException - iteration has no more elements.

remove

public void remove()
Remove operation is not supported by this iterator.

Specified by:
remove in interface java.util.Iterator
Throws:
java.lang.UnsupportedOperationException - the remove operation is not supported by this iterator.