java.util.Iterator<E>
, Unmodifiable
public final class UnmodifiableIterator<E> extends java.lang.Object implements java.util.Iterator<E>, Unmodifiable
Attempts to modify it will result in an UnsupportedOperationException.
Modifier and Type | Method | Description |
---|---|---|
boolean |
hasNext() |
|
E |
next() |
|
void |
remove() |
|
static <E> java.util.Iterator<E> |
unmodifiableIterator(java.util.Iterator<? extends E> iterator) |
Decorates the specified iterator such that it cannot be modified.
|
public static <E> java.util.Iterator<E> unmodifiableIterator(java.util.Iterator<? extends E> iterator)
If the iterator is already unmodifiable it is returned directly.
E
- the element typeiterator
- the iterator to decoratejava.lang.NullPointerException
- if the iterator is nullpublic boolean hasNext()
hasNext
in interface java.util.Iterator<E>
public void remove()
remove
in interface java.util.Iterator<E>
Copyright © 2001-2019 - Apache Software Foundation