TUM CCSM Commons

edu.tum.cs.commons.collections
Class UnmodifiableIterator<E>

java.lang.Object
  extended by edu.tum.cs.commons.collections.UnmodifiableIterator<E>
All Implemented Interfaces:
java.util.Iterator<E>
Direct Known Subclasses:
UnmodifiableListIterator

public class UnmodifiableIterator<E>
extends java.lang.Object
implements java.util.Iterator<E>

This is a wrapper for a Iterator prohibiting all calls which would modify its owning container. All prohibited methods throw an UnsupportedOperationException.

Version:
$Revision: 26283 $
Author:
Benjamin Hummel, $Author: juergens $
Rating:
GREEN Hash: 73D7E245FAE2147047C3C3D4B19E6C48

Constructor Summary
UnmodifiableIterator(java.util.Iterator<E> i)
          Creates a new unmodifiable iterator from another iterator.
 
Method Summary
 boolean hasNext()
          
 E next()
          
 void remove()
          Operation is not supported.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UnmodifiableIterator

public UnmodifiableIterator(java.util.Iterator<E> i)
Creates a new unmodifiable iterator from another iterator. All modifications to the underlying iterator will directly be visible in this wrapper.

Method Detail

hasNext

public boolean hasNext()

Specified by:
hasNext in interface java.util.Iterator<E>

next

public E next()

Specified by:
next in interface java.util.Iterator<E>

remove

public void remove()
Operation is not supported.

Specified by:
remove in interface java.util.Iterator<E>
Throws:
java.lang.UnsupportedOperationException

TUM CCSM Commons

TUM CCSM Commons - 2.7