Interface IList<V>
- All Superinterfaces:
ICollection<IList<V>,
,V> Iterable<V>
- All Known Implementing Classes:
IList.Mixin
,LinearList
,List
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
equals
(Object o, BiPredicate<V, V> equals) default V
first()
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()
iterator
(long startIndex) default V
last()
linear()
This returns a data structure which is linear, or temporarily mutable.slice
(long start, long end) split
(int parts) Splits the collection into roughly even pieces, for parallel processing.default Spliterator
<V> stream()
default Object[]
toArray()
default V[]
toArray
(IntFunction<V[]> allocator) toList()
-
Method Details
-
update
-
isLinear
default boolean isLinear()- Specified by:
isLinear
in interfaceICollection<IList<V>,
V> - Returns:
- true, if the list is linear
-
addLast
-
addFirst
-
removeLast
-
removeFirst
-
set
- Returns:
- a new list, with the element at
idx
overwritten withvalue
. Ifidx
is equal toICollection.size()
, the value is appended. - Throws:
IndexOutOfBoundsException
- whenidx
is not within[0, size]
-
stream
-
spliterator
- Specified by:
spliterator
in interfaceIterable<V>
-
iterator
-
toArray
- Returns:
- the elements of the list, in an array
-
toArray
- Parameters:
allocator
- a function which creates an array of the specified size- Returns:
- the elements of the list, in a typed array
-
toList
- Returns:
- the collection, represented as a normal Java list, which will throw an
UnsupportedOperationException
for any write
-
split
Description copied from interface:ICollection
Splits the collection into roughly even pieces, for parallel processing. Depending on the size and contents of the collection, this function may not return exactlyparts
subsets.- Specified by:
split
in interfaceICollection<IList<V>,
V> - Parameters:
parts
- the target number of pieces- Returns:
- a list containing subsets of the collection.
-
slice
-
concat
-
first
- Returns:
- the first element
- Throws:
IndexOutOfBoundsException
- if the collection is empty
-
last
- Returns:
- the last element
- Throws:
IndexOutOfBoundsException
- if the collection is empty
-
forked
Description copied from interface:ICollection
This returns a data structure which is forked, which is equivalent to Clojure's persistent data structures, also sometimes called functional or immutable. This is called "forked" because it means that multiple functions can make divergent changes to the data structure without affecting each other.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.
- Specified by:
forked
in interfaceICollection<IList<V>,
V> - Returns:
- a forked form of the data structure
-
linear
Description copied from interface:ICollection
This returns a data structure which is linear, or temporarily mutable. The term "linear", as used here, does not completely align with the formal definition of linear types as used in type theory. It is meant to describe the linear dataflow of the method calls, and as a converse to "forked" data structures.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.
- Specified by:
linear
in interfaceICollection<IList<V>,
V> - Returns:
- a linear form of this data structure
-
equals
-