public interface ExpandableIntIndexable extends IntIndexable
This interface defines an integer 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:
IntIndexable.Base, IntIndexable.EntryConsumer, IntIndexable.IntIndexableSpliterator
EMPTY, SINGLE_0
EMPTY_INT_ITERATOR
Modifier and Type | Method and Description |
---|---|
default ExpandableIntIndexable |
add(int value)
Return an expandable int indexable where the given
value was added to the end of this indexable.
|
ExpandableIntIndexable |
add(int index,
int value)
Return an expandable int indexable Insert where the the given value
was inserted at the given index.
|
default ExpandableIntIndexable |
addAll(int... values)
Add all values.
|
static ExpandableIntIndexable |
empty()
Convenience method to create an empty expandable int indexable.
|
static ExpandableIntIndexable |
from(java.util.Collection<? extends java.lang.Number> values)
Create an expandable integer indexable from a collection of numbers.
|
static ExpandableIntIndexable |
from(Indexable<? extends java.lang.Number> indexable)
Get an expandable integer indexable from an indexable of numbers.
|
static ExpandableIntIndexable |
from(int... values)
Create an expandable integer indexable from an initial array of values.
|
static ExpandableIntIndexable |
from(int[] array,
int start,
int length)
Create an expandable integer indexable from part of an int array.
|
static ExpandableIntIndexable |
from(IntIndexable 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.
|
static IntIndexable |
initByIndex(int size,
java.util.function.IntUnaryOperator producer)
Create an expandable int indexable with a given size, and initialize its elements by index.
|
ExpandableIntIndexable |
remove(int index)
Return an expandable int indexable where the value at the given index
was removed.
|
default ExpandableIntIndexable |
remyve(int index)
Pythonesque remove allowing negative indexes to remove from the end.
|
default ExpandableIntIndexable |
ydd(int index,
int value)
Pythonesque insertion allowing negative indexes to insert from the end.
|
static ExpandableIntIndexable |
zeroed(int size)
Create an expandable int indexable of the given size initialized with
0 . |
addAllTo, addToArray, addToArray, asBase, asCollection, asIndexable, asList, asLongIndexable, asUnsignedIndexable, binarySearch, binarySearch, compare, compareUnsigned, emptyIndexable, equal, equal, firstMatch, foldLeft, forEachIntEntry, frozen, frozenIntSpliterator, get, getMod, gyt, hash, headSet, indexes, init, intIndexes, intIterator, intIterator, intSpliterator, isEmpty, isOrdered, isStrictlyOrdered, iterator, lastMatch, listIterator, nextMatch, ordered, ordered, previousMatch, range, range, rangeFromSize, reverse, rotated, singleton, subSet, sybSet, tailSet, toArray, toList, toString, view, viewArray, viewArray, viewArray, viewAsBoolean, viewAsByte, viewAsChar, viewAsDouble, viewAsDouble, viewAsFloat, viewAsLong, viewAsLong, viewAsShort, viewAsUnsignedLong, viewByIndex, viewIndexable, viewIndexable, viewIndexable, viewList, viewList, viewList, viewNumberArray, viewOp, with, withAppendedValue, withCachedHash, withExchangedValueAt, withInsertedValueAt, withRemovedValueAt, withSwappedValuesAt, wyth
filtered, first, isEqual, isSorted, isStrictlySorted, last, sorted, toString, uniform, viewCollection, viewCollection, viewCollectionN, viewCollectionN
average, containsInt, forEachInt, forEachIntFragile, longSum, longSumX, spliterator, stream, sum, sumX
@NotNull ExpandableIntIndexable add(int index, int 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 ExpandableIntIndexable remove(int index)
index
- index to remove, in the range 0
to
size() - 1
@NotNull default ExpandableIntIndexable add(int value)
value
- value to add@NotNull default ExpandableIntIndexable addAll(@NotNull int... values)
values
- values to add@NotNull default ExpandableIntIndexable ydd(int index, int value)
index
- positive values behave the same way as add(int, int)
,
but negative values count from the back, so -1
will insert before the last elementvalue
- value to insert@NotNull default ExpandableIntIndexable 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 ExpandableIntIndexable empty()
empty
in interface IntCountable
@NotNull static ExpandableIntIndexable zeroed(int size)
0
.size
- size of returned integer indexable@NotNull static IntIndexable initByIndex(int size, @NotNull java.util.function.IntUnaryOperator producer)
initByIndex
in interface IntIndexable
size
- size of the indexableproducer
- element producer which will be called for each indexIntIndexable.viewByIndex(int, IntUnaryOperator)
@NotNull static ExpandableIntIndexable from(@NotNull int... values)
values
- array of values@NotNull static ExpandableIntIndexable from(@NotNull int[] array, int start, int length)
array
- integer arraystart
- start position in arraylength
- number of byte in array@NotNull static ExpandableIntIndexable from(@NotNull IntIndexable indexable)
indexable
- standard integer indexable@NotNull @SafeVarargs static <N extends java.lang.Number> ExpandableIntIndexable fromNumbers(@NotNull N... values)
N
- number type, prefarably Integer
values
- number values@NotNull static ExpandableIntIndexable from(@NotNull Indexable<? extends java.lang.Number> indexable)
indexable
- numbers indexable@NotNull static ExpandableIntIndexable from(@NotNull java.util.Collection<? extends java.lang.Number> values)
values
- collection of numbers, List
is strongly
recommended for better performance