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(java.util.List<? extends E> list)
Constructor that wraps (not copies).
|
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
E object) |
boolean |
add(java.lang.Object object) |
boolean |
addAll(java.util.Collection<? extends E> coll) |
boolean |
addAll(int index,
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.
|
equals, get, hashCode, indexOf, lastIndexOf
contains, containsAll, isEmpty, size, toArray, toArray, toString
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()
public boolean add(java.lang.Object object)
add
in interface java.util.Collection<E>
add
in interface java.util.List<E>
add
in class AbstractCollectionDecorator<E>
public boolean addAll(java.util.Collection<? extends E> coll)
addAll
in interface java.util.Collection<E>
addAll
in interface java.util.List<E>
addAll
in class AbstractCollectionDecorator<E>
public void clear()
clear
in interface java.util.Collection<E>
clear
in interface java.util.List<E>
clear
in class AbstractCollectionDecorator<E>
public boolean remove(java.lang.Object object)
remove
in interface java.util.Collection<E>
remove
in interface java.util.List<E>
remove
in class AbstractCollectionDecorator<E>
public boolean removeAll(java.util.Collection<?> coll)
removeAll
in interface java.util.Collection<E>
removeAll
in interface java.util.List<E>
removeAll
in class AbstractCollectionDecorator<E>
public boolean retainAll(java.util.Collection<?> coll)
retainAll
in interface java.util.Collection<E>
retainAll
in interface java.util.List<E>
retainAll
in class AbstractCollectionDecorator<E>
public java.util.ListIterator<E> listIterator()
listIterator
in interface java.util.List<E>
listIterator
in class AbstractListDecorator<E>
public java.util.ListIterator<E> listIterator(int index)
listIterator
in interface java.util.List<E>
listIterator
in class AbstractListDecorator<E>
public void add(int index, E object)
add
in interface java.util.List<E>
add
in class AbstractListDecorator<E>
public boolean addAll(int index, java.util.Collection<? extends E> coll)
addAll
in interface java.util.List<E>
addAll
in class AbstractListDecorator<E>
public E remove(int index)
remove
in interface java.util.List<E>
remove
in class AbstractListDecorator<E>
public E set(int index, E object)
set
in interface java.util.List<E>
set
in class AbstractListDecorator<E>
public java.util.List<E> subList(int fromIndex, int toIndex)
subList
in interface java.util.List<E>
subList
in class AbstractListDecorator<E>
Copyright © 2010 - 2020 Adobe. All Rights Reserved