isEmpty
in interface
Collection<E>
arg0 |
arg0 arg1 |
addAll
in interface
Collection<E>
c
- collection containing elements to be added to this list
UnsupportedOperationException
- if the
addAll operation is not supported by this list
ClassCastException
- if the class of an element of the specified collection prevents it from being added to this list
NullPointerException
- if the specified collection contains one or more null elements and this list does not permit null elements, or if the specified collection is null
IllegalArgumentException
- if some property of an element of the specified collection prevents it from being added to this list
add(Object)
index
- index at which to insert the first element from the specified collection
c
- collection containing elements to be added to this list
UnsupportedOperationException
- if the
addAll operation is not supported by this list
ClassCastException
- if the class of an element of the specified collection prevents it from being added to this list
NullPointerException
- if the specified collection contains one or more null elements and this list does not permit null elements, or if the specified collection is null
IllegalArgumentException
- if some property of an element of the specified collection prevents it from being added to this list
IndexOutOfBoundsException
- if the index is out of range (
index < 0 || index > size())
clear
in interface
Collection<E>
UnsupportedOperationException
- if the
clear operation is not supported by this list
contains
in interface
Collection<E>
o
- element whose presence in this list is to be tested
ClassCastException
- if the type of the specified element is incompatible with this list (optional)
NullPointerException
- if the specified element is null and this list does not permit null elements (optional)
containsAll
in interface
Collection<E>
c
- collection to be checked for containment in this list
ClassCastException
- if the types of one or more elements in the specified collection are incompatible with this list (optional)
NullPointerException
- if the specified collection contains one or more null elements and this list does not permit null elements (optional), or if the specified collection is null
contains(Object)
block
on each Formula in this list.block |
Iterable
until all elements have been processed or the action throws an exception. Unless otherwise specified by the implementing class, actions are performed in the order of iteration (if an iteration order is specified). Exceptions thrown by the action are relayed to the caller.
The default implementation behaves as if:
for (T t : this)
action.accept(t);
action
- The action to be performed for each element
NullPointerException
- if the specified action is null
index
- index of the element to return
IndexOutOfBoundsException
- if the index is out of range (
index < 0 || index >= size())
o
- element to search for
ClassCastException
- if the type of the specified element is incompatible with this list (optional)
NullPointerException
- if the specified element is null and this list does not permit null elements (optional)
iterator
in interface
Collection<E>
iterator
in interface
Iterable<E>
o
- element to search for
ClassCastException
- if the type of the specified element is incompatible with this list (optional)
NullPointerException
- if the specified element is null and this list does not permit null elements (optional)
next
. An initial call to
previous
would return the element with the specified index minus one.
index
- index of the first element to be returned from the list iterator (by a call to
next
)
IndexOutOfBoundsException
- if the index is out of range (
index < 0 || index > size()
)
Stream
with this collection as its source. It is allowable for this method to return a sequential stream.
This method should be overridden when the spliterator()
method cannot return a spliterator that is IMMUTABLE
, CONCURRENT
, or late-binding. (See spliterator()
for details.)
Stream
from the collection's
Spliterator
.
Stream
over the elements in this collection
remove
in interface
Collection<E>
o
- element to be removed from this list, if present
ClassCastException
- if the type of the specified element is incompatible with this list (optional)
NullPointerException
- if the specified element is null and this list does not permit null elements (optional)
UnsupportedOperationException
- if the
remove operation is not supported by this list
index
- the index of the element to be removed
UnsupportedOperationException
- if the
remove operation is not supported by this list
IndexOutOfBoundsException
- if the index is out of range (
index < 0 || index >= size())
removeAll
in interface
Collection<E>
c
- collection containing elements to be removed from this list
UnsupportedOperationException
- if the
removeAll operation is not supported by this list
ClassCastException
- if the class of an element of this list is incompatible with the specified collection (optional)
NullPointerException
- if this list contains a null element and the specified collection does not permit null elements (optional), or if the specified collection is null
remove(Object)
,
contains(Object)
iterator()
. Each matching element is removed using
Iterator.remove()
. If the collection's iterator does not support removal then an
UnsupportedOperationException
will be thrown on the first matching element.
filter
- a predicate which returns
true
for elements to be removed
true
if any elements were removed
NullPointerException
- if the specified filter is null
UnsupportedOperationException
- if elements cannot be removed from this collection. Implementations may throw this exception if a matching element cannot be removed or if, in general, removal is not supported.
list
:
final ListIterator<E> li = list.listIterator();
while (li.hasNext()) {
li.set(operator.apply(li.next()));
}
If the list's list-iterator does not support the
set
operation then an
UnsupportedOperationException
will be thrown when replacing the first element.
operator
- the operator to apply to each element
UnsupportedOperationException
- if this list is unmodifiable. Implementations may throw this exception if an element cannot be replaced or if, in general, modification is not supported
NullPointerException
- if the specified operator is null or if the operator result is a null value and this list does not permit null elements (optional)
retainAll
in interface
Collection<E>
c
- collection containing elements to be retained in this list
UnsupportedOperationException
- if the
retainAll operation is not supported by this list
ClassCastException
- if the class of an element of this list is incompatible with the specified collection (optional)
NullPointerException
- if this list contains a null element and the specified collection does not permit null elements (optional), or if the specified collection is null
remove(Object)
,
contains(Object)
arg0 arg1 |
size
in interface
Collection<E>
Comparator
.
All elements in this list must be mutually comparable using the specified comparator (that is, c.compare(e1, e2)
must not throw a ClassCastException
for any elements e1
and e2
in the list).
If the specified comparator is null
then all elements in this list must implement the Comparable
interface and the elements' natural ordering should be used.
This list must be modifiable, but need not be resizable.
The implementation takes equal advantage of ascending and descending order in its input array, and can take advantage of ascending and descending order in different parts of the same input array. It is well-suited to merging two or more sorted arrays: simply concatenate the arrays and sort the resulting array.
The implementation was adapted from Tim Peters's list sort for Python ( TimSort). It uses techniques from Peter McIlroy's "Optimistic Sorting and Information Theoretic Complexity", in Proceedings of the Fourth Annual ACM-SIAM Symposium on Discrete Algorithms, pp 467-474, January 1993.
c
- the
Comparator
used to compare list elements. A
null
value indicates that the elements' natural ordering should be used
ClassCastException
- if the list contains elements that are not
mutually comparable using the specified comparator
UnsupportedOperationException
- if the list's list-iterator does not support the
set
operation
IllegalArgumentException
- (optional) if the comparator is found to violate the
Comparator
contract
Spliterator
over the elements in this list.
The Spliterator
reports Spliterator.SIZED
and Spliterator.ORDERED
. Implementations should document the reporting of additional characteristic values.
spliterator
in interface
Collection<E>
spliterator
in interface
Iterable<E>
Iterator
. The spliterator inherits the
fail-fast properties of the list's iterator.
Spliterator
additionally reports
Spliterator.SUBSIZED
.
Spliterator
over the elements in this list
Stream
with this collection as its source.
This method should be overridden when the spliterator()
method cannot return a spliterator that is IMMUTABLE
, CONCURRENT
, or late-binding. (See spliterator()
for details.)
Stream
from the collection's
Spliterator
.
Stream
over the elements in this collection
This method eliminates the need for explicit range operations (of the sort that commonly exist for arrays). Any operation that expects a list can be used as a range operation by passing a subList view instead of a whole list. For example, the following idiom removes a range of elements from a list:
list.subList(from, to).clear();
Similar idioms may be constructed for
indexOf and
lastIndexOf, and all of the algorithms in the
Collections class can be applied to a subList.
The semantics of the list returned by this method become undefined if the backing list (i.e., this list) is structurally modified in any way other than via the returned list. (Structural modifications are those that change the size of this list, or otherwise perturb it in such a fashion that iterations in progress may yield incorrect results.)
fromIndex
- low endpoint (inclusive) of the subList
toIndex
- high endpoint (exclusive) of the subList
IndexOutOfBoundsException
- for an illegal endpoint index value (
fromIndex < 0 || toIndex > size || fromIndex > toIndex)
The returned array will be "safe" in that no references to it are maintained by this list. (In other words, this method must allocate a new array even if this list is backed by an array). The caller is thus free to modify the returned array.
This method acts as bridge between array-based and collection-based APIs.
toArray
in interface
Collection<E>
Arrays.asList(Object[])
arg0 |