| com.sun.tools.javac.util.List
List | public class List extends AbstractCollection implements java.util.List<A>(Code) | | A class for generic linked lists. Links are supposed to be
immutable, the only exception being the incremental construction of
lists via ListBuffers. List is the main container class in
GJC. Most data structures and algorthms in GJC use lists rather
than arrays.
Lists are always trailed by a sentinel element, whose head and tail
are both null.
This is NOT part of any API supported by Sun Microsystems. 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.
|
Field Summary | |
public A | head The first element of the list, supposed to be immutable. | public List<A> | tail The remainder of the list except for its first element, supposed
to be immutable. |
Constructor Summary | |
| List(A head, List<A> tail) Construct a list given its head and tail. |
Method Summary | |
public void | add(int index, A element) | public boolean | addAll(int index, Collection<? extends A> c) | public List<A> | append(A x) Append given element at length, forming and returning
a new list. | public List<A> | appendList(List<A> x) Append given list at length, forming and returning
a new list. | public List<A> | appendList(ListBuffer<A> x) Append given list buffer at length, forming and returning a new
list. | public boolean | contains(Object x) | public static List<T> | convert(Class<T> klass, List> list) | public boolean | equals(Object other) | public static boolean | equals(List xs, List ys) | public static List<A> | fill(int len, A init) Construct a list consisting of a given number of identical elements. | public static List<A> | from(A[] array) Construct a list consisting all elements of given array. | public A | get(int index) | public int | hashCode() | public int | indexOf(Object o) | public boolean | isEmpty() | public Iterator<A> | iterator() | public A | last() The last element in the list, if any, or null. | public int | lastIndexOf(Object o) | public int | length() Return the number of elements in this list. | public ListIterator<A> | listIterator() | public ListIterator<A> | listIterator(int index) | public static List<A> | nil() Construct an empty list. | public boolean | nonEmpty() | public static List<A> | of(A x1) Construct a list consisting of given element. | public static List<A> | of(A x1, A x2) Construct a list consisting of given elements. | public static List<A> | of(A x1, A x2, A x3) Construct a list consisting of given elements. | public static List<A> | of(A x1, A x2, A x3, A... rest) Construct a list consisting of given elements. | public List<A> | prepend(A x) Prepend given element to front of list, forming and returning
a new list. | public List<A> | prependList(List<A> xs) Prepend given list of elements to front of list, forming and returning
a new list. | public A | remove(int index) | public List<A> | reverse() Reverse list. | public A | set(int index, A element) | public List<A> | setTail(List<A> tail) | public int | size() | public java.util.List<A> | subList(int fromIndex, int toIndex) | public T[] | toArray(T[] vec) Copy successive elements of this list into given vector until
list is exhausted or end of vector is reached. | public Object[] | toArray() | public String | toString(String sep) Form a string listing all elements with given separator character. | public String | toString() Form a string listing all elements with comma as the separator character. |
head | public A head(Code) | | The first element of the list, supposed to be immutable.
|
tail | public List<A> tail(Code) | | The remainder of the list except for its first element, supposed
to be immutable.
|
List | List(A head, List<A> tail)(Code) | | Construct a list given its head and tail.
|
add | public void add(int index, A element)(Code) | | |
append | public List<A> append(A x)(Code) | | Append given element at length, forming and returning
a new list.
|
appendList | public List<A> appendList(List<A> x)(Code) | | Append given list at length, forming and returning
a new list.
|
appendList | public List<A> appendList(ListBuffer<A> x)(Code) | | Append given list buffer at length, forming and returning a new
list.
|
contains | public boolean contains(Object x)(Code) | | Does the list contain the specified element?
|
equals | public static boolean equals(List xs, List ys)(Code) | | Are the two lists the same?
|
fill | public static List<A> fill(int len, A init)(Code) | | Construct a list consisting of a given number of identical elements.
Parameters: len - The number of elements in the list. Parameters: init - The value of each element. |
from | public static List<A> from(A[] array)(Code) | | Construct a list consisting all elements of given array.
Parameters: array - an array; if null return an empty list |
get | public A get(int index)(Code) | | |
isEmpty | public boolean isEmpty()(Code) | | Does list have no elements?
|
last | public A last()(Code) | | The last element in the list, if any, or null.
|
length | public int length()(Code) | | Return the number of elements in this list.
|
nil | public static List<A> nil()(Code) | | Construct an empty list.
|
nonEmpty | public boolean nonEmpty()(Code) | | Does list have elements?
|
of | public static List<A> of(A x1)(Code) | | Construct a list consisting of given element.
|
of | public static List<A> of(A x1, A x2)(Code) | | Construct a list consisting of given elements.
|
of | public static List<A> of(A x1, A x2, A x3)(Code) | | Construct a list consisting of given elements.
|
of | public static List<A> of(A x1, A x2, A x3, A... rest)(Code) | | Construct a list consisting of given elements.
|
prepend | public List<A> prepend(A x)(Code) | | Prepend given element to front of list, forming and returning
a new list.
|
prependList | public List<A> prependList(List<A> xs)(Code) | | Prepend given list of elements to front of list, forming and returning
a new list.
|
remove | public A remove(int index)(Code) | | |
reverse | public List<A> reverse()(Code) | | Reverse list.
If the list is empty or a singleton, then the same list is returned.
Otherwise a new list is formed.
|
set | public A set(int index, A element)(Code) | | |
toArray | public T[] toArray(T[] vec)(Code) | | Copy successive elements of this list into given vector until
list is exhausted or end of vector is reached.
|
toString | public String toString(String sep)(Code) | | Form a string listing all elements with given separator character.
|
toString | public String toString()(Code) | | Form a string listing all elements with comma as the separator character.
|
|
|