public interface ExpandableLongIndexable extends LongIndexable
This interface defines a long indexable which allows to change (set, add, remove) its values but is immutable nevertheless. All changing methods return copies, thus guaranteeing immutability.
The internal implementation tries to keep copying a cheap operation, but some access patterns may result in performance degration. It is therefore recommended not to use this in time-critical code.
Initial creation is done by using the following methods:
LongIndexable.Base, LongIndexable.LongIndexableSpliterator
EMPTY
EMPTY_LONG_ITERATOR
Modifier and Type | Method and Description |
---|---|
ExpandableLongIndexable |
add(int index,
long value)
Return an exoandable long indexable Insert where the the given value
was inserted at the given index.
|
default ExpandableLongIndexable |
add(long value)
Return an expandable long indexable where the given
value was added to the end of this indexable.
|
static ExpandableLongIndexable |
empty()
Convenience method to create an empty expandable int indexable.
|
static ExpandableLongIndexable |
from(java.util.Collection<? extends java.lang.Number> values)
Create an expandable integer indexable from a collection of numbers.
|
static ExpandableLongIndexable |
from(Indexable<? extends java.lang.Number> indexable)
Get an expandable integer indexable from an indexable of numbers.
|
static ExpandableLongIndexable |
from(long... values)
Create an expandable integer indexable from an initial array of values.
|
static ExpandableLongIndexable |
from(long[] array,
int start,
int length)
Create an expandable integer indexable from part of an int array.
|
static ExpandableLongIndexable |
from(LongIndexable indexable)
Get an expandable integer indexable from a normal
integer indexable.
|
static <N extends java.lang.Number> |
fromNumbers(N... values)
Get an expandable integer indexable from an array of numbers.
|
ExpandableLongIndexable |
getCopy()
Get an expandable copy of this long indexable.
|
static LongIndexable |
initByIndex(int size,
java.util.function.IntToLongFunction producer)
Create an expandable long indexable with a given size, and initialize its elements by index.
|
ExpandableLongIndexable |
remove(int index)
Return an expandable long indexable where the value at the given index
was removed.
|
default ExpandableLongIndexable |
remyve(int index)
Pythonesque remove allowing negative indexes to remove from the end.
|
default ExpandableLongIndexable |
ydd(int index,
long value)
Pythonesque insertion allowing negative indexes to insert from the end.
|
static ExpandableLongIndexable |
zeroed(int size)
Create an expandable int indexable of the given size initialized with
0.0 . |
addAllTo, addToArray, addToArray, asBase, asCollection, asIndexable, asList, binarySearch, binarySearch, compare, compareUnsigned, emptyIndexable, equal, equal, firstMatch, foldLeft, frozen, frozenLongSpliterator, get, getMod, gyt, hash, headSet, indexes, init, intIndexes, isEmpty, isOrdered, isStrictlyOrdered, iterator, lastMatch, listIterator, longIterator, longIterator, longSpliterator, nextMatch, ordered, ordered, previousMatch, reverse, rotated, singleton, subSet, sybSet, tailSet, toArray, toList, toString, view, viewArray, viewArray, viewArray, viewAsBoolean, viewAsByte, viewAsDouble, viewAsDouble, viewAsFloat, viewAsInt, viewAsInt, viewAsShort, viewByIndex, viewIndexable, viewIndexable, viewIndexable, viewList, viewList, viewList, viewNumberArray, viewOp, withAppendedValue, withCachedHash, withExchangedValueAt, withInsertedValueAt, withRemovedValueAt, withSwappedValuesAt
average, containsLong, forEachLong, forEachLongFragile, spliterator, stream, sum, sumX
@NotNull ExpandableLongIndexable add(int index, long value)
index
- index in the range 0
(insert at first position)
to size()
(insert after last position)value
- value to insert at the given position@NotNull ExpandableLongIndexable remove(int index)
index
- index to remove, in the range 0
to
size() - 1
@NotNull ExpandableLongIndexable getCopy()
this
.@NotNull default ExpandableLongIndexable add(long value)
value
- value to add@NotNull default ExpandableLongIndexable ydd(int index, long value)
index
- positive values behave the same way as add(int, long)
,
but negative values count from the back, so -1
will insert before the last elementvalue
- value to insert@NotNull default ExpandableLongIndexable remyve(int index)
index
- positive values behave the same as remove(int)
,
while negative indexes count from the back, so -1
will remove the last element@NotNull static ExpandableLongIndexable empty()
@NotNull static ExpandableLongIndexable zeroed(int size)
0.0
.size
- size of returned long indexable@NotNull static LongIndexable initByIndex(int size, @NotNull java.util.function.IntToLongFunction producer)
initByIndex
in interface LongIndexable
size
- size of the indexableproducer
- element producer which will be called for each indexLongIndexable.viewByIndex(int, IntToLongFunction)
@NotNull static ExpandableLongIndexable from(@NotNull long... values)
values
- array of values@NotNull static ExpandableLongIndexable from(@NotNull long[] array, int start, int length)
array
- integer arraystart
- start position in arraylength
- number of byte in array@NotNull static ExpandableLongIndexable from(@NotNull LongIndexable indexable)
indexable
- standard integer indexable@NotNull @SafeVarargs static <N extends java.lang.Number> ExpandableLongIndexable fromNumbers(@NotNull N... values)
N
- number type, prefarably Integer
values
- number values@NotNull static ExpandableLongIndexable from(@NotNull Indexable<? extends java.lang.Number> indexable)
indexable
- numbers indexable@NotNull static ExpandableLongIndexable from(@NotNull java.util.Collection<? extends java.lang.Number> values)
values
- collection of numbers, List
is strongly
recommended for better performance