|
Modifier and Type |
Method and Description |
|
appending |
abstract IList<V> appending(V value)
Return a list with an additional value added at the end.
-
Return a list with an additional value added at the end.
- Parameters:
value - The value to be appended.
- Returns:
- A list with the values from this list, plus the specified value.
|
|
appendingAll |
abstract IList<V> appendingAll(Iterable<? extends V> values)
Return a list with additional values added at the end.
IList< V> appendingAll(Iterable<? extends V> values)
throws IllegalArgumentException
-
Return a list with additional values added at the end.
- Parameters:
values - An iterator providing the values to be appended.
- Returns:
- A list with the values from this list, plus the specified values.
- Throws:
IllegalArgumentException - if the iterator returns a null element.
|
|
contains |
boolean contains(Object target)
Return true if and only if the specified value is an element of the list.
boolean contains(Object target)
-
Return true if and only if the specified value is an element of the list.
- Specified by:
contains in interface ICollection<V>
- Parameters:
target - The value to find in the list.
- Returns:
- true if and only if
target is an element of the list.
|
|
find |
<R> R find(FindVisitor<V,R> visitor)
Visit the elements of the list from the first element to the last element until the visitor returns a non-null
result.
-
Visit the elements of the list from the first element to the last element until the visitor returns a non-null
result.
- Specified by:
find in interface ICollection<V>
- Parameters:
visitor - The visitor to call on the list elements.
- Returns:
- the first non-null result returned by the visitor, or null if none.
|
|
find |
<R> R find(FindVisitor<V,R> visitor,
R defaultValue)
Visit each element of the list from the first element to the last element until the visitor returns a non-null
result.
-
Visit each element of the list from the first element to the last element until the visitor returns a non-null
result.
- Specified by:
find in interface ICollection<V>
- Parameters:
visitor - The visitor to call on the list elements.defaultValue - The value to return if the visitor never returns a non-null result.
- Returns:
- the first non-null result returned by the visitor, or
defaultValue if none.
|
|
first |
Return the first element of the list.
V first()
throws NoSuchElementException
-
Return the first element of the list.
- Returns:
- the first element of the list.
- Throws:
NoSuchElementException - if the list is empty.
|
|
forEach |
void forEach(Consumer<? super T> arg0)
void forEach(Consumer<? super T> arg0)
|
|
get |
Return the element with the specified index.
V get(int index)
throws IndexOutOfBoundsException
-
Return the element with the specified index.
- Parameters:
index - The index.
- Returns:
- the designated element.
- Throws:
IndexOutOfBoundsException - if there is no element with the specified index.
|
|
getElements |
abstract IList<V> getElements(int index,
int count)
Return the elements with consecutive indexes.
IList< V> getElements(int index,
int count)
throws IndexOutOfBoundsException
-
Return the elements with consecutive indexes.
- Parameters:
index - The index of the first element to return.count - The number of elements to return.
- Returns:
- the designated elements (empty if
count is zero).
- Throws:
IndexOutOfBoundsException - if count is negative or the specified index range identifies elements
that are not present.
|
|
getOptional |
Return the element with the specified index.
-
Return the element with the specified index.
- Parameters:
index - The index.
- Returns:
- the designated element, or null if there is no element with that index.
|
|
indexOf |
int indexOf(Object element)
Return the index of the specified element in the list.
int indexOf(Object element)
-
Return the index of the specified element in the list.
- Parameters:
element - The element to find.
- Returns:
- the index of
element in the list, or -1 if element is not an element of the list.
|
|
inserting |
IList<V> inserting(int position,
V value)
Return a list with a new value inserted at the specified position.
IList< V> inserting(int position,
V value)
throws IndexOutOfBoundsException
-
Return a list with a new value inserted at the specified position.
- Parameters:
position - The position at which the value is inserted.value - The value to insert as an element of the returned list.
- Throws:
IndexOutOfBoundsException - if position is not a valid position.
|
|
insertingAll |
IList<V> insertingAll(int position,
Iterable<? extends V> values)
Return a list with new values inserted at the specified position.
IList< V> insertingAll(int position,
Iterable<? extends V> values)
throws IndexOutOfBoundsException,
IllegalArgumentException
-
Return a list with new values inserted at the specified position.
- Parameters:
position - The position at which the values are inserted.values - The values to insert as elements of the returned list.
- Throws:
IndexOutOfBoundsException - if position is not a valid position.
IllegalArgumentException - if the iterator returns a null element.
|
|
isEmpty |
abstract boolean isEmpty()
Return true if and only if there are no elements in the list.
boolean isEmpty()
-
Return true if and only if there are no elements in the list.
- Specified by:
isEmpty in interface ICollection<V>
|
|
iterator |
Returns an iterator over non-null elements of type T .
-
Returns an iterator over non-null elements of type T .
- Specified by:
iterator in interface Iterable<T>
- Returns:
- an Iterator.
|
|
last |
Return the last element of the list.
V last()
throws NoSuchElementException
-
Return the last element of the list.
- Returns:
- the last element of the list.
- Throws:
NoSuchElementException - if the list is empty.
|
|
map |
abstract <R> IList<R> map(Function<V,R> mapper)
Return a list containing the result of applying a mapper to each list element.
<R> IList<R> map(Function< V,R> mapper)
-
Return a list containing the result of applying a mapper to each list element.
- Parameters:
mapper - Maps elements of the list to elements of the result. The mapper must not return null.
- Returns:
- a list containing the results of the mapper calls.
|
|
mapFilter |
abstract <R> IList<R> mapFilter(Function<V,R> mapper)
Return a list containing the result of applying a mapper to each list element.
<R> IList<R> mapFilter(Function< V,R> mapper)
-
Return a list containing the result of applying a mapper to each list element.
- Parameters:
mapper - Maps elements of the list to elements of the result. If the mapper returns null, no element is
added to the result.
- Returns:
- a list containing the non-null results of the mapper calls.
|
|
onReverse |
Return a list containing the same elements as this list, but in the reverse order.
-
Return a list containing the same elements as this list, but in the reverse order.
The returned list may be a view on this list rather than a copy of this list. A view can provide much
better performance by avoiding the need to copy the list when the result is used only to perform traversals.
|
|
onSlice |
IList<V> onSlice(int start,
int end)
Return a list containing a designated subsequence of the elements of this list.
IList< V> onSlice(int start,
int end)
throws IndexOutOfBoundsException
-
Return a list containing a designated subsequence of the elements of this list.
The returned list is called a slice of this list.
The slice may be a view on this list rather than a copy of this list. A view can provide much better
performance by avoiding the need to copy the list, especially when the slice is used to perform traversals. The
implication is that the slice may hold a strong reference to this list, preventing this list from being reclaimed
before the slice. Using this method is most appropriate when it is used only to perform a single operation and is
not retained.
- Parameters:
start - The index of the first element to be included in the slice.end - One greater than the index of the last element to be included in the slice. If this parameter is
greater than the size of this list, it is interpreted as if it were specified as the size of this list.
- Throws:
IndexOutOfBoundsException - if start is negative or greater than the size of this list or if
end is less than start .
|
|
optimize |
abstract IList<V> optimize(ListUsage usage)
Return an equivalent list whose representation efficiently supports the specified usage.
-
Return an equivalent list whose representation efficiently supports the specified usage.
|
|
optimizeForForwardTraversal |
abstract IList<V> optimizeForForwardTraversal()
Return an equivalent list whose representation efficiently supports forward traversal.
IList< V> optimizeForForwardTraversal()
-
Return an equivalent list whose representation efficiently supports forward traversal.
|
|
optimizeForIndexing |
abstract IList<V> optimizeForIndexing()
Return an equivalent list whose representation efficiently supports indexed access to list elements.
IList< V> optimizeForIndexing()
-
Return an equivalent list whose representation efficiently supports indexed access to list elements.
|
|
optionalFirst |
Return the first element of the list.
-
Return the first element of the list.
- Returns:
- the first element of the list, or null if the list is empty.
|
|
optionalLast |
Return the last element of the list.
-
Return the last element of the list.
- Returns:
- the last element of the list, or null if the list is empty.
|
|
prepending |
abstract IList<V> prepending(V value)
Return a list with an additional value added at the beginning.
-
Return a list with an additional value added at the beginning.
- Parameters:
value - The value to be added.
- Returns:
- A list with the specified value, plus the values from this list.
|
|
removing |
abstract IList<V> removing(int index,
int count)
Return a list with consecutive elements removed.
IList< V> removing(int index,
int count)
throws IndexOutOfBoundsException
-
Return a list with consecutive elements removed.
- Parameters:
index - The index of the first element to remove.count - The number of elements to remove.
- Returns:
- A list with the values from this list, in the same order, except the removed elements.
- Throws:
IndexOutOfBoundsException - if index does not identify an existing element or if count is
less than zero. No exception is thrown if count exceeds the available elements or if count is
zero.
|
|
removing |
abstract IList<V> removing(Object value)
Return this list with a value removed.
IList< V> removing(Object value)
-
Return this list with a value removed.
- Parameters:
value - The value to be removed (if present).
- Returns:
- A list with the values from this list, in the same order, but exclusing all instances of the specified
value.
|
|
removingAll |
IList<V> removingAll(ISet<?> values)
Return a list with the values from this list, in the same order, except that all instances of the specified values
are excluded.
-
Return a list with the values from this list, in the same order, except that all instances of the specified values
are excluded.
- Parameters:
values - The values to be excluded in the result.
- Returns:
- A list with the values from this list, except the specified values.
|
|
removingFirst |
Return this list with the first element removed.
-
Return this list with the first element removed. If this list is empty, the empty list is returned.
- Returns:
- A list with the values from this list, except the first element.
|
|
removingLast |
Return this list with the last element removed.
-
Return this list with the last element removed. If this list is empty, the empty list is returned.
- Returns:
- A list with the values from this list, except the last element.
|
|
replacing |
abstract IList<V> replacing(int index,
V value)
Return a list with a new value for the specified element.
IList< V> replacing(int index,
V value)
throws IndexOutOfBoundsException
-
Return a list with a new value for the specified element.
- Throws:
IndexOutOfBoundsException - if this list does not contain an element with the specified index.
|
|
replacingAll |
abstract IList<V> replacingAll(int index,
int count,
Iterable<? extends V> values)
Return a list with new values replacing the specified elements.
IList< V> replacingAll(int index,
int count,
Iterable<? extends V> values)
throws IndexOutOfBoundsException,
IllegalArgumentException
-
Return a list with new values replacing the specified elements.
- Parameters:
index - The position of the first element to replace.count - The number of elements to replace. With a count of zero this operation is equivalent to
insertingAll(int, java.lang.Iterable<? extends V>) .values - The values to replace the designated elements.
- Throws:
IndexOutOfBoundsException - if index does not identify an existing element or if count is
less than zero. No exception is thrown if count exceeds the available elements or if count is
zero.
IllegalArgumentException - if the iterator returns a null element.
|
|
reverse |
Return a list containing the same elements as this list, but in the reverse order.
-
Return a list containing the same elements as this list, but in the reverse order.
|
|
size |
abstract int size()
Return the number of elements in the list.
int size()
-
Return the number of elements in the list.
- Specified by:
size in interface ICollection<V>
|
|
sort |
Return a list containing the same elements as this list, but sorted using the natural comparator.
-
Return a list containing the same elements as this list, but sorted using the natural comparator.
- Specified by:
sort in interface ICollection<V>
- Returns:
- the sorted list.
|
|
sort |
abstract IList<V> sort(Comparator<? super V> c)
Return a list containing the same elements as this list, but sorted using the specified comparator.
IList< V> sort(Comparator<? super V> c)
-
Return a list containing the same elements as this list, but sorted using the specified comparator.
- Specified by:
sort in interface ICollection<V>
- Parameters:
c - The comparator used to determine the order of the elements in the returned list.
- Returns:
- the sorted list.
|
|
spliterator |
Spliterator<V> spliterator()
Return a Spliterator that yields the elements of the collection.
Spliterator< V> spliterator()
-
Return a Spliterator that yields the elements of the collection.
- Specified by:
spliterator in interface ICollection<V>
- Specified by:
spliterator in interface Iterable<V>
|
|
stream |
Return a stream of the elements of the collection.
-
Return a stream of the elements of the collection.
|
|
toJavaArray |
<E> E[] toJavaArray(E[] template)
Return a new Java array containing the elements of this collection.
<E> E[] toJavaArray(E[] template)
-
Return a new Java array containing the elements of this collection.
|
|
toJavaList |
Return a new Java list containing the elements of this list, in the same order.
-
Return a new Java list containing the elements of this list, in the same order.
- Specified by:
toJavaList in interface ICollection<V>
|
|
toJavaSet |
Return a new Java set containing the elements of this collection.
-
Return a new Java set containing the elements of this collection.
- Specified by:
toJavaSet in interface ICollection<V>
|
|
toJavaUnmodifiableList |
List<V> toJavaUnmodifiableList()
Return a new unmodifiable Java list containing the elements of this collection, in the same order (if the
collection defines an order).
List< V> toJavaUnmodifiableList()
-
Return a new unmodifiable Java list containing the elements of this collection, in the same order (if the
collection defines an order).
|
|
toJavaUnmodifiableSet |
Set<V> toJavaUnmodifiableSet()
Return a new Java set containing the elements of this collection.
Set< V> toJavaUnmodifiableSet()
-
Return a new Java set containing the elements of this collection.
|
|
visit |
void visit(Visitor<V> visitor)
Visit each element of the list from the first element to the last element.
-
Visit each element of the list from the first element to the last element.
- Specified by:
visit in interface ICollection<V>
- Parameters:
visitor - The visitor to call on the list elements.
|