public class List<V> extends Object implements IList<V>, Cloneable
slice(),
concat(), and split() are near-constant time.| Modifier and Type | Field and Description |
|---|---|
static List |
EMPTY |
Object[] |
prefix |
Object[] |
suffix |
| Modifier | Constructor and Description |
|---|---|
|
List() |
protected |
List(boolean linear,
io.lacuna.bifurcan.nodes.ListNodes.Node root,
int prefixLen,
Object[] prefix,
int suffixLen,
Object[] suffix) |
| Modifier and Type | Method and Description |
|---|---|
List<V> |
addFirst(V value) |
List<V> |
addLast(V value) |
List<V> |
clone() |
IList<V> |
concat(IList<V> l) |
boolean |
equals(Object obj) |
List<V> |
forked()
This returns a data structure which is forked, which is equivalent to Clojure's persistent
data structures, also sometimes called functional or immutable.
|
static <V> List<V> |
from(IList<V> list) |
static <V> List<V> |
from(Iterable<V> iterable) |
static <V> List<V> |
from(Iterator<V> iterator) |
boolean |
isLinear() |
Iterator<V> |
iterator() |
List<V> |
linear()
This returns a data structure which is linear, or temporarily mutable.
|
V |
nth(long idx) |
static <V> List<V> |
of(V... elements) |
List<V> |
removeFirst() |
List<V> |
removeLast() |
List<V> |
set(long idx,
V value) |
long |
size() |
List<V> |
slice(long start,
long end) |
String |
toString() |
finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitequals, first, last, save, split, spliterator, stream, toArray, toArray, toList, updatenthpublic static final List EMPTY
public Object[] prefix
public Object[] suffix
public static <V> List<V> of(V... elements)
public V nth(long idx)
nth in interface ICollection<IList<V>,V>idxpublic long size()
size in interface ICollection<IList<V>,V>public boolean isLinear()
public List<V> removeLast()
removeLast in interface IList<V>public List<V> removeFirst()
removeFirst in interface IList<V>public List<V> set(long idx, V value)
set in interface IList<V>idx overwritten with value. If idx is equal to ICollection.size(), the value is appended.public List<V> forked()
ICollectionIf only a single function or scope uses the data structure, it can be left as a linear data structure, which can have significant performance benefits.
If the data structure is already forked, it will simply return itself.
public List<V> linear()
ICollection
If ICollection.forked() is called on a linear collection, all references to that linear collection should be discarded.
If the data structure is already linear, it will simply return itself.