public interface IList<V> extends ICollection<IList<V>,V>, Iterable<V>
Modifier and Type | Interface and Description |
---|---|
static interface |
IList.Durable<V> |
static class |
IList.Mixin<V> |
Modifier and Type | Method and Description |
---|---|
default IList<V> |
addFirst(V value) |
default IList<V> |
addLast(V value) |
default IList<V> |
concat(IList<V> l) |
default IDiffList<V> |
diff() |
default boolean |
equals(Object o,
BiPredicate<V,V> equals) |
default V |
first() |
default IList<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.
|
default boolean |
isLinear() |
default Iterator<V> |
iterator(long startIndex) |
default V |
last() |
default IList<V> |
linear()
This returns a data structure which is linear, or temporarily mutable.
|
default IList<V> |
removeFirst() |
default IList<V> |
removeLast() |
default DurableList<V> |
save(IDurableEncoding encoding,
Path directory) |
default IList<V> |
set(long idx,
V value) |
default IList<V> |
slice(long start,
long end) |
default IList<IList<V>> |
split(int parts)
Splits the collection into roughly even pieces, for parallel processing.
|
default Spliterator<V> |
spliterator() |
default Stream<V> |
stream() |
default Object[] |
toArray() |
default V[] |
toArray(IntFunction<V[]> allocator) |
default List<V> |
toList() |
default IList<V> |
update(long idx,
Function<V,V> updateFn) |
default boolean isLinear()
isLinear
in interface ICollection<IList<V>,V>
default IList<V> removeLast()
default IList<V> removeFirst()
default IList<V> set(long idx, V value)
idx
overwritten with value
. If idx
is equal to
ICollection.size()
, the value is appended.IndexOutOfBoundsException
- when idx
is not within [0, size]
default Spliterator<V> spliterator()
spliterator
in interface Iterable<V>
default Iterator<V> iterator(long startIndex)
iterator
in interface ICollection<IList<V>,V>
default Object[] toArray()
default V[] toArray(IntFunction<V[]> allocator)
allocator
- a function which creates an array of the specified sizedefault List<V> toList()
UnsupportedOperationException
for any writedefault IList<IList<V>> split(int parts)
ICollection
parts
subsets.split
in interface ICollection<IList<V>,V>
parts
- the target number of piecesdefault IList<V> slice(long start, long end)
start
- the inclusive start of the rangeend
- the exclusive end of the range[start, end)
, which is linear if this
is lineardefault IList<V> concat(IList<V> l)
l
- another listthis
is lineardefault V first()
IndexOutOfBoundsException
- if the collection is emptydefault V last()
IndexOutOfBoundsException
- if the collection is emptydefault DurableList<V> save(IDurableEncoding encoding, Path directory)
save
in interface ICollection<IList<V>,V>
default IList<V> forked()
ICollection
If 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.
forked
in interface ICollection<IList<V>,V>
default IList<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.
linear
in interface ICollection<IList<V>,V>
default boolean equals(Object o, BiPredicate<V,V> equals)