|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjfun.util.List
public abstract class List
Immutable single list.
Field Summary | |
---|---|
static List |
nil
the empty list. |
Constructor Summary | |
---|---|
List()
|
Method Summary | |
---|---|
List |
cons(java.lang.Object obj)
add an object to the head of the list. |
boolean |
equals(java.lang.Object other)
|
static List |
fromArray(java.lang.Object arr)
Create a list using the elements of the array. |
static List |
fromArray(java.lang.Object[] arr)
Create a list using the elements of the array. |
int |
hashCode()
|
abstract java.lang.Object |
head()
Get the first object in the list. |
abstract boolean |
isEmpty()
Tests whether it is empty. |
List |
rev()
reverse the list. |
abstract List |
revAppend(List l)
reverse the list and append it to the tail of list l. |
java.lang.Object[] |
revArray()
convert the list to an array in reverse order. |
java.lang.Object[] |
revArray(int from,
java.lang.Object[] arr)
add the elements of the list to an array from a certain position in reverse order. |
java.lang.Object[] |
revArray(java.lang.Object[] arr)
add the elements of the list to an array in reverse order. |
abstract int |
size()
Get the size. |
abstract List |
tail()
Get the tail of the list. |
java.lang.Object[] |
toArray()
convert the list to an array. |
java.lang.Object[] |
toArray(int from,
java.lang.Object[] arr)
add the elements of the list to an array from a certain position. |
java.lang.Object[] |
toArray(java.lang.Object[] arr)
add the elements of the list to an array. |
void |
toList(java.util.List to)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final List nil
Constructor Detail |
---|
public List()
Method Detail |
---|
public abstract boolean isEmpty()
Sizeable
isEmpty
in interface Sizeable
public abstract java.lang.Object head()
public abstract List tail()
public List rev()
public abstract List revAppend(List l)
l
- the list to append to.
public abstract int size()
Sizeable
size
in interface Sizeable
public List cons(java.lang.Object obj)
obj
- the object to add.
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public void toList(java.util.List to)
public java.lang.Object[] toArray()
public java.lang.Object[] toArray(java.lang.Object[] arr)
arr
- the array to store the list elements.
public java.lang.Object[] toArray(int from, java.lang.Object[] arr)
from
- the starting index to store list elemnt to.arr
- the array to store the list elements.
public java.lang.Object[] revArray()
public java.lang.Object[] revArray(java.lang.Object[] arr)
arr
- the array to store the list elements.
public java.lang.Object[] revArray(int from, java.lang.Object[] arr)
from
- the starting index to store list elemnt to.arr
- the array to store the list elements.
public static List fromArray(java.lang.Object[] arr)
arr
- the array to populate the list.
public static List fromArray(java.lang.Object arr)
arr
- the array to populate the list.
It can be any array including array of primitive types.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |