org.apache.commons.collections.iterators
Class UnmodifiableIterator<E>

java.lang.Object
  extended by org.apache.commons.collections.iterators.UnmodifiableIterator<E>
All Implemented Interfaces:
Iterator<E>, Unmodifiable

public final class UnmodifiableIterator<E>
extends Object
implements Iterator<E>, Unmodifiable

Decorates an iterator such that it cannot be modified.

Since:
Commons Collections 3.0
Version:
$Revision: 1.1.1.1 $ $Date: 2005/05/23 04:35:03 $
Author:
Matt Hall, John Watkinson, Stephen Colebourne

Method Summary
static
<E> Iterator<E>
decorate(Iterator<E> iterator)
          Decorates the specified iterator such that it cannot be modified.
 boolean hasNext()
           
 E next()
           
 void remove()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

decorate

public static <E> Iterator<E> decorate(Iterator<E> iterator)
Decorates the specified iterator such that it cannot be modified.

If the iterator is already unmodifiable it is returned directly.

Parameters:
iterator - the iterator to decorate
Throws:
IllegalArgumentException - if the iterator is null

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator<E>

next

public E next()
Specified by:
next in interface Iterator<E>

remove

public void remove()
Specified by:
remove in interface Iterator<E>


Copyright © 2005-2005 Apache Software Foundation, Matt Hall, John Watkinson. All Rights Reserved.