Lists are always trailed by a sentinel element, whose head and tail are both null.
This is NOT part of any supported API. If you write code that depends on this, you do so at your own risk. This code and its internal interfaces are subject to change or deletion without notice.
| Modifier and Type | Field and Description |
|---|---|
| private static final List | |
| public A | head
The first element of the list, supposed to be immutable. |
| public List | tail
The remainder of the list except for its first element, supposed to be immutable. |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public void | add(int index, A element)
Implements java. Inserts the specified element at the specified position in this list (optional operation). |
| public boolean | addAll(int index, Collection<? extends A> c)
Implements java. Inserts all of the elements in the specified collection into this list at the specified position (optional operation). |
| public List | |
| public List | |
| public List | |
| public static <Z> Collector | |
| public boolean | contains(Object x)
Overrides java. Implements java. Does the list contain the specified element? |
| public static <T> List | |
| public List | |
| public boolean | equals(Object other)
Overrides java. Implements java. Is this list the same as other list? |
| public static boolean | |
| public static <A> List | fill(int
The number of elements in the list. len, A The value of each element. init)
Deprecated
Construct a list consisting of a given number of identical elements. |
| public static <A> List | |
| public static <A> List | from(A[]
an array; if array)null return an empty listConstruct a list consisting all elements of given array. |
| public static <A> List | |
| public A | get(int index)
Implements java. Returns the element at the specified position in this list. |
| public int | hashCode()
Overrides java. Implements java. Compute a hash code, overrides Object |
| public int | indexOf(Object o)
Implements java. Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element. |
| public List | |
| public boolean | isEmpty()
Overrides java. Implements java. Does list have no elements? |
| public Iterator | iterator()
Implements abstract java. Implements java. Returns an iterator over the elements in this list in proper sequence. |
| public A | |
| public int | lastIndexOf(Object o)
Implements java. Returns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element. |
| public int | |
| public ListIterator | listIterator()
Implements java. Returns a list iterator over the elements in this list (in proper sequence). |
| public ListIterator | listIterator(int index)
Implements java. Returns a list iterator over the elements in this list (in proper sequence), starting at the specified position in the list. |
| public <Z> List | |
| public static <A> List | |
| public boolean | |
| public static <A> List | |
| public static <A> List | |
| public static <A> List | |
| public static <A> List | of(A x1, A x2, A x3, A... rest)
Hides java. Construct a list consisting of given elements. |
| public List | |
| public List | prependList(List<A> xs)
Prepend given list of elements to front of list, forming and returning a new list. |
| public A | remove(int index)
Implements java. Removes the element at the specified position in this list (optional operation). |
| public List | |
| public A | set(int index, A element)
Implements java. Replaces the element at the specified position in this list with the specified element (optional operation). |
| public List | |
| public int | size()
Implements abstract java. Implements java. Returns the number of elements in this list. |
| public List | subList(int fromIndex, int toIndex)
Implements java. Returns a view of the portion of this list between the specified
|
| public List | |
| public <T> T[] | toArray(T[] vec)
Overrides java. Implements java. Copy successive elements of this list into given vector until list is exhausted or end of vector is reached. |
| public Object[] | toArray()
Overrides java. Implements java. Returns an array containing all of the elements in this list in proper sequence (from first to last element). |
| public String | |
| public String | toString()
Overrides java. Form a string listing all elements with comma as the separator character. |
| EMPTY_LIST | back to summary |
|---|---|
| private static final List<?> EMPTY_LIST | |
| head | back to summary |
|---|---|
| public A head The first element of the list, supposed to be immutable. | |
| tail | back to summary |
|---|---|
| public List<A> tail The remainder of the list except for its first element, supposed to be immutable. | |
| List | back to summary |
|---|---|
| pack-priv List(A head, List<A> tail) Construct a list given its head and tail. | |
| add | back to summary |
|---|---|
| public void add(int index, A element) Implements java. Doc from java. Inserts the specified element at the specified position in this list (optional operation). Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices). | |
| addAll | back to summary |
|---|---|
| public boolean addAll(int index, Collection<? extends A> c) Implements java. Doc from java. Inserts all of the elements in the specified collection into this list at the specified position (optional operation). Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). The new elements will appear in this list in the order that they are returned by the specified collection's iterator. The behavior of this operation is undefined if the specified collection is modified while the operation is in progress. (Note that this will occur if the specified collection is this list, and it's nonempty.) | |
| append | back to summary |
|---|---|
| public List Append given element at length, forming and returning a new list. | |
| appendList | back to summary |
|---|---|
| public List Append given list at length, forming and returning a new list. | |
| appendList | back to summary |
|---|---|
| public List Append given list buffer at length, forming and returning a new list. | |
| collector | back to summary |
|---|---|
| public static <Z> Collector Collect elements into a new list (using a | |
| contains | back to summary |
|---|---|
| public boolean contains(Object x) Overrides java. Implements java. Does the list contain the specified element?
| |
| convert | back to summary |
|---|---|
public static <T> List
| |
| diff | back to summary |
|---|---|
| public List | |
| equals | back to summary |
|---|---|
| public boolean equals(Object other) Overrides java. Implements java. Is this list the same as other list?
| |
| equals | back to summary |
|---|---|
| public static boolean equals(List<?> xs, List<?> ys) Are the two lists the same? | |
| fill | back to summary |
|---|---|
| public static <A> List Deprecated
Construct a list consisting of a given number of identical elements.
| |
| filter | back to summary |
|---|---|
| public static <A> List Returns the list obtained from 'l' after removing all elements 'elem' | |
| from | back to summary |
|---|---|
| public static <A> List Construct a list consisting all elements of given array.
| |
| from | back to summary |
|---|---|
| public static <A> List | |
| get | back to summary |
|---|---|
| public A get(int index) Implements java. Doc from java. Returns the element at the specified position in this list. | |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Implements java. Compute a hash code, overrides Object
| |
| indexOf | back to summary |
|---|---|
| public int indexOf(Object o) Implements java. Doc from java. Returns the index of the first occurrence of the specified element
in this list, or -1 if this list does not contain the element.
More formally, returns the lowest index | |
| intersect | back to summary |
|---|---|
| public List | |
| isEmpty | back to summary |
|---|---|
| public boolean isEmpty() Overrides java. Implements java. Does list have no elements?
| |
| iterator | back to summary |
|---|---|
| public Iterator Implements abstract java. Implements java. Doc from java. Returns an iterator over the elements in this list in proper sequence.
| |
| last | back to summary |
|---|---|
| public A last() The last element in the list, if any, or null. | |
| lastIndexOf | back to summary |
|---|---|
| public int lastIndexOf(Object o) Implements java. Doc from java. Returns the index of the last occurrence of the specified element
in this list, or -1 if this list does not contain the element.
More formally, returns the highest index | |
| length | back to summary |
|---|---|
| public int length() Return the number of elements in this list. | |
| listIterator | back to summary |
|---|---|
| public ListIterator Implements java. Doc from java. Returns a list iterator over the elements in this list (in proper sequence). | |
| listIterator | back to summary |
|---|---|
| public ListIterator Implements java. Doc from java. Returns a list iterator over the elements in this list (in proper
sequence), starting at the specified position in the list.
The specified index indicates the first element that would be
returned by an initial call to | |
| map | back to summary |
|---|---|
public <Z> List
| |
| nil | back to summary |
|---|---|
| public static <A> List Construct an empty list.
| |
| nonEmpty | back to summary |
|---|---|
| public boolean nonEmpty() Does list have elements? | |
| of | back to summary |
|---|---|
| public static <A> List Hides java. Construct a list consisting of given element. | |
| of | back to summary |
|---|---|
| public static <A> List Hides java. Construct a list consisting of given elements. | |
| of | back to summary |
|---|---|
| public static <A> List Hides java. Construct a list consisting of given elements. | |
| of | back to summary |
|---|---|
| public static <A> List Hides java. Construct a list consisting of given elements.
| |
| prepend | back to summary |
|---|---|
| public List Prepend given element to front of list, forming and returning a new list. | |
| prependList | back to summary |
|---|---|
| public List Prepend given list of elements to front of list, forming and returning a new list. | |
| remove | back to summary |
|---|---|
| public A remove(int index) Implements java. Doc from java. Removes the element at the specified position in this list (optional operation). Shifts any subsequent elements to the left (subtracts one from their indices). Returns the element that was removed from the list. | |
| reverse | back to summary |
|---|---|
| public List Reverse list. If the list is empty or a singleton, then the same list is returned. Otherwise a new list is formed. | |
| set | back to summary |
|---|---|
| public A set(int index, A element) Implements java. Doc from java. Replaces the element at the specified position in this list with the specified element (optional operation). | |
| setTail | back to summary |
|---|---|
| public List | |
| size | back to summary |
|---|---|
| public int size() Implements abstract java. Implements java. Doc from java. Returns the number of elements in this list. If this list contains
more than
| |
| subList | back to summary |
|---|---|
| public List Implements java. Doc from java. Returns a view of the portion of this list between the specified
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:
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.) | |
| take | back to summary |
|---|---|
| public List Create a new list from the first | |
| toArray | back to summary |
|---|---|
| public <T> T[] toArray(T[] vec) Overrides java. Implements java. Copy successive elements of this list into given vector until list is exhausted or end of vector is reached.
| |
| toArray | back to summary |
|---|---|
| public Object[] toArray() Overrides java. Implements java. Doc from java. Returns an array containing all of the elements in this list in proper sequence (from first to last element). 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. | |
| toString | back to summary |
|---|---|
| public String toString(String sep) Form a string listing all elements with given separator character. | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Form a string listing all elements with comma as the separator character.
| |