com.evanmclean.evlib.util
Class UnmodifiableIterator<E>
java.lang.Object
com.evanmclean.evlib.util.UnmodifiableIterator<E>
- Type Parameters:
E
-
- All Implemented Interfaces:
- Iterator<E>
public class UnmodifiableIterator<E>
- extends Object
- implements Iterator<E>
Wrapper around an Iterable
or an Iterator
that makes an
iterator that will throw an UnsupportedOperationException
if
remove()
is called.
- Author:
- Evan McLean McLean Computer Services (see the
overview for copyright and licensing.)
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
UnmodifiableIterator
public UnmodifiableIterator(Iterable<? extends E> iterable)
UnmodifiableIterator
public UnmodifiableIterator(Iterator<? extends E> iterator)
create
public static <E> UnmodifiableIterator<E> create(Iterable<? extends E> iterable)
create
public static <E> UnmodifiableIterator<E> create(Iterator<? extends E> iterator)
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interface Iterator<E>
next
public E next()
- Specified by:
next
in interface Iterator<E>
remove
public void remove()
- Specified by:
remove
in interface Iterator<E>