public abstract class AbstractBasicUnmodifiableList<T>
extends java.lang.Object
implements java.util.List<T>
Constructor and Description |
---|
AbstractBasicUnmodifiableList() |
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
T element)
Inserts the specified element at the specified position in this list
(optional operation).
|
boolean |
add(T o)
Appends the specified element to the end of this list (optional
operation).
|
boolean |
addAll(java.util.Collection c)
Appends all of the elements in the specified collection to the end of
this list, in the order that they are returned by the specified
collection's iterator (optional operation).
|
boolean |
addAll(int index,
java.util.Collection<? extends T> c)
Inserts all of the elements in the specified collection into this
list at the specified position (optional operation).
|
void |
clear()
Removes all of the elements from this list (optional operation).
|
T |
remove(int index)
Removes the element at the specified position in this list (optional
operation).
|
boolean |
remove(java.lang.Object o)
Removes the first occurrence in this list of the specified element
(optional operation).
|
boolean |
removeAll(java.util.Collection c)
Removes from this list all the elements that are contained in the
specified collection (optional operation).
|
boolean |
retainAll(java.util.Collection c)
Retains only the elements in this list that are contained in the
specified collection (optional operation).
|
T |
set(int index,
T element)
Replaces the element at the specified position in this list with the
specified element (optional operation).
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public void clear()
public T remove(int index)
remove
in interface java.util.List<T>
index
- the index of the element to removed.java.lang.UnsupportedOperationException
- if the remove method is
not supported by this list.java.lang.IndexOutOfBoundsException
- if the index is out of range (index
< 0 || index >= size()).public boolean remove(java.lang.Object o)
remove
in interface java.util.Collection<T>
remove
in interface java.util.List<T>
o
- element to be removed from this list, if present.java.lang.ClassCastException
- if the type of the specified element
is incompatible with this list (optional).java.lang.NullPointerException
- if the specified element is null and this
list does not support null elements (optional).java.lang.UnsupportedOperationException
- if the remove method is
not supported by this list.public boolean addAll(int index, @NotNull java.util.Collection<? extends T> c)
addAll
in interface java.util.List<T>
index
- index at which to insert first element from the specified
collection.c
- elements to be inserted into this list.java.lang.UnsupportedOperationException
- if the addAll method is
not supported by this list.java.lang.ClassCastException
- if the class of one of elements of the
specified collection prevents it from being added to this
list.java.lang.NullPointerException
- if the specified collection contains one
or more null elements and this list does not support null
elements, or if the specified collection is null.java.lang.IllegalArgumentException
- if some aspect of one of elements of
the specified collection prevents it from being added to
this list.java.lang.IndexOutOfBoundsException
- if the index is out of range (index
< 0 || index > size()).public boolean addAll(@NotNull java.util.Collection c)
addAll
in interface java.util.Collection<T>
addAll
in interface java.util.List<T>
c
- collection whose elements are to be added to this list.java.lang.UnsupportedOperationException
- if the addAll method is
not supported by this list.java.lang.ClassCastException
- if the class of an element in the specified
collection prevents it from being added to this list.java.lang.NullPointerException
- if the specified collection contains one
or more null elements and this list does not support null
elements, or if the specified collection is null.java.lang.IllegalArgumentException
- if some aspect of an element in the
specified collection prevents it from being added to this
list.add(Object)
public boolean removeAll(@NotNull java.util.Collection c)
removeAll
in interface java.util.Collection<T>
removeAll
in interface java.util.List<T>
c
- collection that defines which elements will be removed from
this list.java.lang.UnsupportedOperationException
- if the removeAll method
is not supported by this list.java.lang.ClassCastException
- if the types of one or more elements
in this list are incompatible with the specified
collection (optional).java.lang.NullPointerException
- if this list contains one or more
null elements and the specified collection does not support
null elements (optional).
or if the specified collection is
null.remove(Object)
,
List.contains(Object)
public boolean retainAll(@NotNull java.util.Collection c)
retainAll
in interface java.util.Collection<T>
retainAll
in interface java.util.List<T>
c
- collection that defines which elements this set will retain.java.lang.UnsupportedOperationException
- if the retainAll method
is not supported by this list.java.lang.ClassCastException
- if the types of one or more elements
in this list are incompatible with the specified
collection (optional).java.lang.NullPointerException
- if this list contains one or more
null elements and the specified collection does not support
null elements (optional).
or if the specified collection is
null.remove(Object)
,
List.contains(Object)
public T set(int index, T element)
set
in interface java.util.List<T>
index
- index of element to replace.element
- element to be stored at the specified position.java.lang.UnsupportedOperationException
- if the set method is not
supported by this list.java.lang.ClassCastException
- if the class of the specified element
prevents it from being added to this list.java.lang.NullPointerException
- if the specified element is null and
this list does not support null elements.java.lang.IllegalArgumentException
- if some aspect of the specified
element prevents it from being added to this list.java.lang.IndexOutOfBoundsException
- if the index is out of range
(index < 0 || index >= size()).public void add(int index, T element)
add
in interface java.util.List<T>
index
- index at which the specified element is to be inserted.element
- element to be inserted.java.lang.UnsupportedOperationException
- if the add method is not
supported by this list.java.lang.ClassCastException
- if the class of the specified element
prevents it from being added to this list.java.lang.NullPointerException
- if the specified element is null and
this list does not support null elements.java.lang.IllegalArgumentException
- if some aspect of the specified
element prevents it from being added to this list.java.lang.IndexOutOfBoundsException
- if the index is out of range
(index < 0 || index > size()).public boolean add(T o)
Lists that support this operation may place limitations on what elements may be added to this list. In particular, some lists will refuse to add null elements, and others will impose restrictions on the type of elements that may be added. List classes should clearly specify in their documentation any restrictions on what elements may be added.
add
in interface java.util.Collection<T>
add
in interface java.util.List<T>
o
- element to be appended to this list.java.lang.UnsupportedOperationException
- if the add method is not
supported by this list.java.lang.ClassCastException
- if the class of the specified element
prevents it from being added to this list.java.lang.NullPointerException
- if the specified element is null and this
list does not support null elements.java.lang.IllegalArgumentException
- if some aspect of this element
prevents it from being added to this list.