public final class UnmodifiableIterator extends java.lang.Object implements java.util.Iterator, Unmodifiable
| Modifier and Type | Field and Description |
|---|---|
private java.util.Iterator |
iterator
The iterator being decorated
|
| Modifier | Constructor and Description |
|---|---|
private |
UnmodifiableIterator(java.util.Iterator iterator)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
static java.util.Iterator |
decorate(java.util.Iterator iterator)
Decorates the specified iterator such that it cannot be modified.
|
boolean |
hasNext() |
java.lang.Object |
next() |
void |
remove() |
private UnmodifiableIterator(java.util.Iterator iterator)
iterator - the iterator to decoratepublic static java.util.Iterator decorate(java.util.Iterator iterator)
If the iterator is already unmodifiable it is returned directly.
iterator - the iterator to decoratejava.lang.IllegalArgumentException - if the iterator is nullpublic boolean hasNext()
hasNext in interface java.util.Iteratorpublic java.lang.Object next()
next in interface java.util.Iteratorpublic void remove()
remove in interface java.util.Iterator