org.grinvin.util

Class IteratorWithoutRemove<T>

Implemented Interfaces:
Iterator

public class IteratorWithoutRemove<T>
extends java.lang.Object
implements Iterator

Allows the use of an existing iterator in such a way that the remove operation throws an UnsupportedOperationException.

Constructor Summary

IteratorWithoutRemove(Iterator iterator)
Create a new iterator that is backed by the given iterator of the same type, but does not allow the user to call its remove method.

Method Summary

boolean
hasNext()
T
next()
void
remove()

Constructor Details

IteratorWithoutRemove

public IteratorWithoutRemove(Iterator iterator)
Create a new iterator that is backed by the given iterator of the same type, but does not allow the user to call its remove method.

Method Details

hasNext

public boolean hasNext()

next

public T next()

remove

public void remove()