|
Copyright 2008 - 2009 Tony Morris, Runar Bjarnason, Tom Adams, Brad Clow, Ricky Clarkson, Nick Partridge, Jason Zaugg This software is released under an open source BSD licence. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfj.data.Seq<A>
public final class Seq<A>
Provides an immutable finite sequence, implemented as a finger tree. This structure gives O(1) access to the head and tail, as well as O(log n) random access and concatenation of sequences.
Method Summary | ||
---|---|---|
Seq<A> |
append(Seq<A> as)
Appends the given sequence to this sequence. |
|
Seq<A> |
cons(A a)
Inserts the given element at the front of this sequence. |
|
static
|
empty()
The empty sequence. |
|
A |
index(int i)
Returns the element at the given index. |
|
boolean |
isEmpty()
Checks if this is the empty sequence. |
|
int |
length()
Returns the number of elements in this sequence. |
|
static
|
single(A a)
A singleton sequence. |
|
Seq<A> |
snoc(A a)
Inserts the given element at the end of this sequence. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static <A> Seq<A> empty()
public static <A> Seq<A> single(A a)
a
- The single element in the sequence.
public Seq<A> cons(A a)
a
- An element to insert at the front of this sequence.
public Seq<A> snoc(A a)
a
- An element to insert at the end of this sequence.
public Seq<A> append(Seq<A> as)
as
- A sequence to append to this one.
public boolean isEmpty()
public int length()
public A index(int i)
i
- The index of the element to return.
|
Copyright 2008 - 2009 Tony Morris, Runar Bjarnason, Tom Adams, Brad Clow, Ricky Clarkson, Nick Partridge, Jason Zaugg This software is released under an open source BSD licence. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |