Unmodifiable
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 | Description |
---|---|
UnmodifiableList(java.util.List<? extends E> list) |
Constructor that wraps (not copies).
|
Modifier and Type | Method | Description |
---|---|---|
void |
add(int index,
E object) |
|
boolean |
add(java.lang.Object object) |
|
boolean |
addAll(int index,
java.util.Collection<? extends E> coll) |
|
boolean |
addAll(java.util.Collection<? extends E> coll) |
|
void |
clear() |
|
java.util.Iterator<E> |
iterator() |
|
java.util.ListIterator<E> |
listIterator() |
|
java.util.ListIterator<E> |
listIterator(int index) |
|
E |
remove(int index) |
|
boolean |
remove(java.lang.Object object) |
|
boolean |
removeAll(java.util.Collection<?> coll) |
|
boolean |
retainAll(java.util.Collection<?> coll) |
|
E |
set(int index,
E object) |
|
java.util.List<E> |
subList(int fromIndex,
int toIndex) |
|
static <E> java.util.List<E> |
unmodifiableList(java.util.List<? extends E> list) |
Factory method to create an unmodifiable list.
|
contains, containsAll, isEmpty, setCollection, size, toArray, toArray, toString
decorated, equals, get, hashCode, indexOf, lastIndexOf
public UnmodifiableList(java.util.List<? extends E> list)
list
- the list to decorate, must not be nulljava.lang.NullPointerException
- if list is nullpublic static <E> java.util.List<E> unmodifiableList(java.util.List<? extends E> list)
E
- the type of the elements in the listlist
- the list to decorate, must not be nulljava.lang.NullPointerException
- if list is nullpublic java.util.Iterator<E> iterator()
iterator
in class AbstractCollectionDecorator<E>
public boolean add(java.lang.Object object)
add
in class AbstractCollectionDecorator<E>
public boolean addAll(java.util.Collection<? extends E> coll)
addAll
in class AbstractCollectionDecorator<E>
public void clear()
clear
in class AbstractCollectionDecorator<E>
public boolean remove(java.lang.Object object)
remove
in class AbstractCollectionDecorator<E>
public boolean removeAll(java.util.Collection<?> coll)
removeAll
in class AbstractCollectionDecorator<E>
public boolean retainAll(java.util.Collection<?> coll)
retainAll
in class AbstractCollectionDecorator<E>
public java.util.ListIterator<E> listIterator()
listIterator
in class AbstractListDecorator<E>
public java.util.ListIterator<E> listIterator(int index)
listIterator
in class AbstractListDecorator<E>
public void add(int index, E object)
add
in class AbstractListDecorator<E>
public boolean addAll(int index, java.util.Collection<? extends E> coll)
addAll
in class AbstractListDecorator<E>
public E remove(int index)
remove
in class AbstractListDecorator<E>
public E set(int index, E object)
set
in class AbstractListDecorator<E>
public java.util.List<E> subList(int fromIndex, int toIndex)
subList
in class AbstractListDecorator<E>
Copyright © 2001-2019 - Apache Software Foundation