public interface ICollection<C,V> extends Iterable<V>
Modifier and Type | Method and Description |
---|---|
C |
clone() |
C |
forked()
This returns a data structure which is forked, which is equivalent to Clojure's persistent
data structures, also sometimes called functional or immutable.
|
boolean |
isLinear() |
default Iterator<V> |
iterator() |
Iterator<V> |
iterator(long startIndex) |
C |
linear()
This returns a data structure which is linear, or temporarily mutable.
|
V |
nth(long idx) |
default V |
nth(long idx,
V defaultValue) |
default C |
save(IDurableEncoding encoding,
Path directory) |
long |
size() |
IList<? extends C> |
split(int parts)
Splits the collection into roughly even pieces, for parallel processing.
|
forEach, spliterator
C linear()
If 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.
boolean isLinear()
C forked()
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.
IList<? extends C> split(int parts)
parts
subsets.parts
- the target number of pieceslong size()
V nth(long idx)
idx
IndexOutOfBoundsException
- when idx
is not within [0, size-1]
default V nth(long idx, V defaultValue)
idx
, or defaultValue
if it is not within [0, size-1]
C clone()
default C save(IDurableEncoding encoding, Path directory)