net.walend.collection
Class ImmutableIteratorWrapper

java.lang.Object
  |
  +--net.walend.collection.ImmutableIteratorWrapper
All Implemented Interfaces:
java.util.Iterator

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

Use this class to block Iterator's remove method in Immutable classes.

Since:
20010815
Author:
David Walend

Field Summary
private  java.util.Iterator it
           
 
Constructor Summary
ImmutableIteratorWrapper(java.util.Iterator iterator)
           
 
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

it

private java.util.Iterator it
Constructor Detail

ImmutableIteratorWrapper

public ImmutableIteratorWrapper(java.util.Iterator iterator)
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 - to keep the collection immutable.


Copyright (c) 2000, 2001, David Walend