public final class DList<A>
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
DList<A> |
append(DList<A> other)
Appends two DLists together to produce a new DList.
|
static <A> DList<A> |
arrayDList(A... as)
Creates a DList from an array
|
DList<A> |
cons(A a)
Prepends a single element on the DList to produce a new DList.
|
static <A> DList<A> |
dlist(F<List<A>,Trampoline<List<A>>> f)
Creates a DList from the function
For alternatives functions to create a DList:
|
static <A> DList<A> |
iterableDList(java.lang.Iterable<A> it)
Creates a DList from an Iterable
|
static <A> DList<A> |
iteratorDList(java.util.Iterator<A> it)
Creates a DList from an Iterator
|
static <A> DList<A> |
listDList(List<A> a)
Creates a DList from a List
|
static <A> DList<A> |
nil()
A empty DList.
|
List<A> |
run()
Concatenates all the internal Lists together that are held in
the DList's lambda's state to produce a List.
|
static <A> DList<A> |
single(A a)
Produces a DList with one element.
|
DList<A> |
snoc(A a)
Appends a single element on the end of the DList to produce a new DList.
|
java.util.List<A> |
toJavaList()
Converts the DList to a standard java.util.List.
|
public static <A> DList<A> dlist(F<List<A>,Trampoline<List<A>>> f)
public static <A> DList<A> iterableDList(java.lang.Iterable<A> it)
public static <A> DList<A> iteratorDList(java.util.Iterator<A> it)
@SafeVarargs public static <A> DList<A> arrayDList(A... as)
public List<A> run()
public java.util.List<A> toJavaList()
public static <A> DList<A> nil()
A
- public static <A> DList<A> single(A a)
A
- a
- the element in the DList.public DList<A> cons(A a)
a
- the element to append.public DList<A> snoc(A a)
a
- the element to append.