public final class CollectionUtils extends Object
Modifier and Type | Method and Description |
---|---|
static <T> Iterator<T> |
immutableIterator(Iterator<T> iterator)
Returns an immutable view of the specified
Iterator . |
static <T> ListIterator<T> |
immutableListIterator(ListIterator<T> iterator)
Returns an immutable view of the specified
ListIterator . |
public static <T> Iterator<T> immutableIterator(Iterator<T> iterator)
Iterator
. The
method that can modify the collection, Iterator.remove()
,
will throw an UnsupportedOperationException
. Otherwise, it will
defer to the specified Iterator
.public static <T> ListIterator<T> immutableListIterator(ListIterator<T> iterator)
ListIterator
. The
methods that can modify the collection will throw an
UnsupportedOperationException
. Otherwise, it will
defer to the specified ListIterator
.
The methods that can modify the collection and will throw an
UnsupportedOperationException
are:
T
- the type of the ListIterator
's generic parameteriterator
- the ListIterator
to create an immutable view forListIterator
Copyright © 2021 Frostphyr. All rights reserved.