net.walend.enum
Class IteratorOfImmutable

java.lang.Object
  |
  +--net.walend.enum.IteratorOfImmutable
All Implemented Interfaces:
java.util.Iterator

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

Use this class to wrap Iterators when the Collection is Immutable.

Author:
David Walend david@walend.net

Field Summary
private  java.util.Iterator wrapped
           
 
Constructor Summary
IteratorOfImmutable(java.util.Iterator it)
           
 
Method Summary
 boolean hasNext()
           
 java.lang.Object next()
           
 void remove()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

wrapped

private java.util.Iterator wrapped
Constructor Detail

IteratorOfImmutable

public IteratorOfImmutable(java.util.Iterator it)
Method Detail

hasNext

public boolean hasNext()
Specified by:
hasNext in interface java.util.Iterator

next

public java.lang.Object next()
Specified by:
next in interface java.util.Iterator

remove

public void remove()
Specified by:
remove in interface java.util.Iterator
Throws:
java.lang.UnsupportedOperationException - because the underlying collection is immutable.


Copyright (c) 2001, 2002, David Walend