public final class UnmodifiableList<E> extends AbstractSerializableListDecorator<E> implements Unmodifiable
List to ensure it can't be altered.
This class is Serializable from Commons Collections 3.1.
Attempts to modify it will result in an UnsupportedOperationException.
| Constructor and Description |
|---|
UnmodifiableList(List
Constructor that wraps (not copies).
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(int index, E object)
|
boolean |
add(Object
|
boolean |
addAll(Collection
|
boolean |
addAll(int index, Collection
|
void |
clear()
|
Iterator |
iterator()
|
ListIterator |
listIterator()
|
ListIterator |
listIterator(int index)
|
E |
remove(int index)
|
boolean |
remove(Object
|
boolean |
removeAll(Collection
|
boolean |
retainAll(Collection
|
E |
set(int index, E object)
|
List |
subList(int fromIndex, int toIndex)
|
static <E> List |
unmodifiableList(List
Factory method to create an unmodifiable list.
|
decorated, equals, get, hashCode, indexOf, lastIndexOfcontains, containsAll, isEmpty, setCollection, size, toArray, toArray, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitcontains, containsAll, isEmpty, replaceAll, size, sort, spliterator, toArray, toArrayparallelStream, removeIf, streampublic UnmodifiableList(List<? extends E> list)
list - the list to decorate, must not be null
NullPointerException - if list is null
public static <E> List<E> unmodifiableList(List <? extends E> list)
E - the type of the elements in the list
list - the list to decorate, must not be null
NullPointerException - if list is null
public boolean add(Objectobject)
public boolean addAll(Collection<? extends E> coll)
public void clear()
public boolean remove(Objectobject)
public boolean removeAll(Collection<?> coll)
public boolean retainAll(Collection<?> coll)
public ListIterator<E> listIterator()
public ListIterator<E> listIterator(int index)
public void add(int index,
E object)public boolean addAll(int index,
Collection<? extends E> coll) public E remove(int index)