cosmic.util
Class ImmutableIterator

java.lang.Object
  |
  +--cosmic.util.ImmutableIterator
All Implemented Interfaces:
java.util.Iterator

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

A class of iterator that does not allow modification of the underlying collection. Author: James.A.Marshall@imperial.ac.uk


Field Summary
private  java.util.Iterator mIterator
          The iterator that the immutable iterator uses
 
Constructor Summary
ImmutableIterator(java.util.Iterator iterator)
          Constructor for the ImmutableIterator class
 
Method Summary
 boolean hasNext()
          Returns true if the iterator has more elements.
 java.lang.Object next()
          Returns the next element in the iteration
 void remove()
          Removal through an immutable iterator is not permitted
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mIterator

private java.util.Iterator mIterator
The iterator that the immutable iterator uses

Constructor Detail

ImmutableIterator

public ImmutableIterator(java.util.Iterator iterator)
Constructor for the ImmutableIterator class

Method Detail

hasNext

public boolean hasNext()
Returns true if the iterator has more elements.

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 iteration

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

remove

public void remove()
Removal through an immutable iterator is not permitted

Specified by:
remove in interface java.util.Iterator
Returns:
void
Throws:
java.lang.RuntimeException - if called