|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractCollection<A>
com.sun.tools.javac.util.List<A>
public class List<A>
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 | |
---|---|
private static List<?> |
EMPTY_LIST
|
private static java.util.Iterator<?> |
EMPTYITERATOR
|
A |
head
The first element of the list, supposed to be immutable. |
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 | ||
---|---|---|
void |
add(int index,
A element)
|
|
boolean |
addAll(int index,
java.util.Collection<? extends A> c)
|
|
List<A> |
append(A x)
Append given element at length, forming and returning a new list. |
|
List<A> |
appendList(List<A> x)
Append given list at length, forming and returning a new list. |
|
List<A> |
appendList(ListBuffer<A> x)
Append given list buffer at length, forming and returning a new list. |
|
boolean |
contains(java.lang.Object x)
Does the list contain the specified element? |
|
static
|
convert(java.lang.Class<T> klass,
List<?> list)
|
|
private static
|
emptyIterator()
|
|
static boolean |
equals(List<?> xs,
List<?> ys)
Are the two lists the same? |
|
boolean |
equals(java.lang.Object other)
Is this list the same as other list? |
|
static
|
fill(int len,
A init)
Deprecated. |
|
static
|
from(A[] array)
Construct a list consisting all elements of given array. |
|
A |
get(int index)
|
|
int |
hashCode()
Compute a hash code, overrides Object |
|
int |
indexOf(java.lang.Object o)
|
|
boolean |
isEmpty()
Does list have no elements? |
|
java.util.Iterator<A> |
iterator()
|
|
A |
last()
The last element in the list, if any, or null. |
|
int |
lastIndexOf(java.lang.Object o)
|
|
int |
length()
Return the number of elements in this list. |
|
java.util.ListIterator<A> |
listIterator()
|
|
java.util.ListIterator<A> |
listIterator(int index)
|
|
static
|
nil()
Construct an empty list. |
|
boolean |
nonEmpty()
Does list have elements? |
|
static
|
of(A x1)
Construct a list consisting of given element. |
|
static
|
of(A x1,
A x2)
Construct a list consisting of given elements. |
|
static
|
of(A x1,
A x2,
A x3)
Construct a list consisting of given elements. |
|
static
|
of(A x1,
A x2,
A x3,
A... rest)
Construct a list consisting of given elements. |
|
List<A> |
prepend(A x)
Prepend given element to front of list, forming and returning a new list. |
|
List<A> |
prependList(List<A> xs)
Prepend given list of elements to front of list, forming and returning a new list. |
|
A |
remove(int index)
|
|
List<A> |
reverse()
Reverse list. |
|
A |
set(int index,
A element)
|
|
List<A> |
setTail(List<A> tail)
|
|
int |
size()
|
|
java.util.List<A> |
subList(int fromIndex,
int toIndex)
|
|
java.lang.Object[] |
toArray()
|
|
|
toArray(T[] vec)
Copy successive elements of this list into given vector until list is exhausted or end of vector is reached. |
|
java.lang.String |
toString()
Form a string listing all elements with comma as the separator character. |
|
java.lang.String |
toString(java.lang.String sep)
Form a string listing all elements with given separator character. |
Methods inherited from class java.util.AbstractCollection |
---|
add, addAll, clear, containsAll, remove, removeAll, retainAll |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.List |
---|
add, addAll, clear, containsAll, remove, removeAll, retainAll |
Field Detail |
---|
public A head
public List<A> tail
private static List<?> EMPTY_LIST
private static java.util.Iterator<?> EMPTYITERATOR
Constructor Detail |
---|
List(A head, List<A> tail)
Method Detail |
---|
public static <A> List<A> nil()
public static <A> List<A> of(A x1)
public static <A> List<A> of(A x1, A x2)
public static <A> List<A> of(A x1, A x2, A x3)
public static <A> List<A> of(A x1, A x2, A x3, A... rest)
public static <A> List<A> from(A[] array)
array
- an array; if null
return an empty list@Deprecated public static <A> List<A> fill(int len, A init)
len
- The number of elements in the list.init
- The value of each element.public boolean isEmpty()
isEmpty
in interface java.util.Collection<A>
isEmpty
in interface java.util.List<A>
isEmpty
in class java.util.AbstractCollection<A>
public boolean nonEmpty()
public int length()
public int size()
size
in interface java.util.Collection<A>
size
in interface java.util.List<A>
size
in class java.util.AbstractCollection<A>
public List<A> setTail(List<A> tail)
public List<A> prepend(A x)
public List<A> prependList(List<A> xs)
public List<A> reverse()
public List<A> append(A x)
public List<A> appendList(List<A> x)
public List<A> appendList(ListBuffer<A> x)
public <T> T[] toArray(T[] vec)
toArray
in interface java.util.Collection<A>
toArray
in interface java.util.List<A>
toArray
in class java.util.AbstractCollection<A>
public java.lang.Object[] toArray()
toArray
in interface java.util.Collection<A>
toArray
in interface java.util.List<A>
toArray
in class java.util.AbstractCollection<A>
public java.lang.String toString(java.lang.String sep)
public java.lang.String toString()
toString
in class java.util.AbstractCollection<A>
public int hashCode()
hashCode
in interface java.util.Collection<A>
hashCode
in interface java.util.List<A>
hashCode
in class java.lang.Object
List.hashCode()
public boolean equals(java.lang.Object other)
equals
in interface java.util.Collection<A>
equals
in interface java.util.List<A>
equals
in class java.lang.Object
List.equals(java.lang.Object)
public static boolean equals(List<?> xs, List<?> ys)
public boolean contains(java.lang.Object x)
contains
in interface java.util.Collection<A>
contains
in interface java.util.List<A>
contains
in class java.util.AbstractCollection<A>
public A last()
public static <T> List<T> convert(java.lang.Class<T> klass, List<?> list)
private static <A> java.util.Iterator<A> emptyIterator()
public java.util.Iterator<A> iterator()
iterator
in interface java.lang.Iterable<A>
iterator
in interface java.util.Collection<A>
iterator
in interface java.util.List<A>
iterator
in class java.util.AbstractCollection<A>
public A get(int index)
get
in interface java.util.List<A>
public boolean addAll(int index, java.util.Collection<? extends A> c)
addAll
in interface java.util.List<A>
public A set(int index, A element)
set
in interface java.util.List<A>
public void add(int index, A element)
add
in interface java.util.List<A>
public A remove(int index)
remove
in interface java.util.List<A>
public int indexOf(java.lang.Object o)
indexOf
in interface java.util.List<A>
public int lastIndexOf(java.lang.Object o)
lastIndexOf
in interface java.util.List<A>
public java.util.ListIterator<A> listIterator()
listIterator
in interface java.util.List<A>
public java.util.ListIterator<A> listIterator(int index)
listIterator
in interface java.util.List<A>
public java.util.List<A> subList(int fromIndex, int toIndex)
subList
in interface java.util.List<A>
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |