public interface MutableIntIndexable extends IntIndexable, Copyable<MutableIntIndexable>
int[]
as it eg allows
read-only views or transparent views of subsets of the array.Modifier and Type | Interface and Description |
---|---|
static class |
MutableIntIndexable.Base
Abstract base class which provides useful implementations
for
Object.equals(Object) , Object.hashCode() ,
Object.toString() . |
IntIndexable.IntIndexableSpliterator
Modifier and Type | Field and Description |
---|---|
static MutableIntIndexable.Base |
EMPTY
Empty mutable indexable.
|
SINGLE_0
EMPTY_INT_ITERATOR
Modifier and Type | Method and Description |
---|---|
default java.util.List<java.lang.Integer> |
asList()
View this indexable as a standard list.
|
static MutableIntIndexable.Base |
based(MutableIntIndexable indexable)
View any mutable int indexable as a base int indexable.
|
static <IN> MutableIntIndexable.Base |
copy(java.util.Collection<IN> collection,
java.util.function.Function<IN,java.lang.Number> copier)
Create a mutable indexable which is initialized from copied elements of
a given collection.
|
static MutableIntIndexable.Base |
copyOf(java.util.Collection<? extends java.lang.Number> collection)
Create a mutable indexable which is initialized from a
given collection.
|
static MutableIntIndexable.Base |
empty() |
static MutableIntIndexable.Base |
fromArray(int... elements)
Create a mutable indexable which is initialized from eleemnts
of the given array.
|
static MutableIntIndexable.Base |
fromArray(int[] elements,
int startIndex,
int length)
Create a mutable indexable which is initialized from elements
of the given array.
|
static MutableIntIndexable.Base |
fromByteIndexable(ByteIndexable indexable)
Return a mutable int indexable initialized with the content of a
standard byte indexable.
|
static MutableIntIndexable.Base |
fromDoubleIndexable(DoubleIndexable indexable)
Return a mutable int indexable initialized with the content of a
standard double indexable.
|
static MutableIntIndexable.Base |
fromFloatIndexable(FloatIndexable indexable)
Return a mutable int indexable initialized with the content of a
standard float indexable.
|
static MutableIntIndexable.Base |
fromIndexable(Indexable<? extends java.lang.Number> indexable)
Create a mutable indexable which is the copy of a standard indexable.
|
static <B> MutableIntIndexable.Base |
fromIndexable(Indexable<B> indexable,
java.util.function.Function<? super B,? extends java.lang.Number> converter)
Create a mutable indexable which is the copy of a standard indexable.
|
static MutableIntIndexable.Base |
fromIntIndexable(IntIndexable indexable)
Return a mutable int indexable initialized with the content of a
standard int indexable.
|
static MutableIntIndexable.Base |
fromIterable(int size,
java.lang.Iterable<? extends java.lang.Number> iter)
Create a mutable indexable from an iterable or a part of it.
|
static MutableIntIndexable.Base |
fromLongIndexable(LongIndexable indexable)
Return a mutable int indexable initialized with the content of a
standard long indexable.
|
static MutableIntIndexable.Base |
fromShortIndexable(ShortIndexable indexable)
Return a mutable int indexable initialized with the content of a
standard short indexable.
|
default MutableIntIndexable |
getCopy()
Get a copy of this object.
|
default MutableIntIndexable.Base |
headSet(int toIndex)
Create an indexable subset from the last elements of this indexable set.
|
static MutableIntIndexable.Base |
init(int size,
int value)
Create a mutable
|
static MutableIntIndexable.Base |
init(int size,
java.util.function.IntSupplier creator)
Initialize a mutable indexable to a given size.
|
static MutableIntIndexable.Base |
initByIndex(int size,
java.util.function.IntUnaryOperator producer)
Get a mutable integer indexable of a given size which contains elements created by index.
|
default void |
initByIndex(java.util.function.IntUnaryOperator setter)
Set all values of this integer indexable by index.
|
default MutableIntIndexable.Base |
reverse()
Get this indexable but with inverted order.
|
void |
set(int index,
int value)
Set the element at the given index.
|
default int |
setFrom(java.lang.Iterable<? extends java.lang.Number> iterable)
Set the values of this mutable int indexable one after
the other from the given Number iterable until either the
iterable is emptied or
Sizeable.size() elements are set. |
default int |
setFrom(java.lang.Iterable<? extends java.lang.Number> iterable,
int startIndex,
int numElements)
Set the values of this mutable int indexable one after
the other from the given iterable until either the
iterable is emptied or
numElements elements are set. |
default MutableIntIndexable.Base |
subSet(int fromIndex,
int toIndex)
Get an indexable subset.
|
default MutableIntIndexable.Base |
sybSet(int fromIndex,
int toIndex)
Get an indexable subset.
|
default void |
syt(int index,
int value)
Pythonesque set.
|
default MutableIntIndexable.Base |
tailSet(int fromIndex)
Create an indexable subset from the last elements of this indexable set.
|
static MutableIntIndexable.Base |
viewArray(int[] array)
Mutable indexable view which operates on the given array.
|
static <T> MutableIntIndexable.Base |
viewIndexable(Indexable<T> indexable,
java.util.function.ToIntFunction<? super T> getter,
IntSetter<? super T> setter)
View a generic indexable as a mutable int indexable by accessing
a int property of the elements of the underlying generic indexable.
|
static MutableIntIndexable.Base |
viewList(java.util.List<java.lang.Integer> list)
Mutable indexable view which operates on the given array.
|
static MutableIntIndexable.Base |
zeroed(int size)
Create a mutable int indexable with
size
0.0 elements. |
addAllTo, addToArray, addToArray, asBase, asCollection, asIndexable, asLongIndexable, asUnsignedIndexable, compare, compareUnsigned, emptyIndexable, equal, equal, firstMatch, foldLeft, frozen, frozenIntSpliterator, get, gyt, hash, indexes, intIndexes, intIterator, intIterator, intSpliterator, isEmpty, iterator, lastMatch, listIterator, nextMatch, previousMatch, range, range, rangeFromSize, rotated, singleton, toArray, toList, toString, view, viewArray, viewAsBoolean, viewAsByte, viewAsDouble, viewAsDouble, viewAsFloat, viewAsLong, viewAsLong, viewAsShort, viewAsUnsignedLong, viewByIndex, viewIndexable, viewIndexable, viewIndexable, viewList, viewList, viewList, viewNumberArray, with, withAppendedValue, withCachedHash, withExchangedValueAt, withInsertedValueAt, withRemovedValueAt, withSwappedValuesAt, wyth
average, containsInt, forEachInt, forEachIntFragile, longSum, longSumX, spliterator, stream, sum, sumX
static final MutableIntIndexable.Base EMPTY
empty()
instead.void set(int index, int value)
index
- index between 0
and size() - 1
value
- value to put to the given indexdefault void syt(int index, int value)
-1
references the last element, -2
its predecessor, and so on.index
- index between -size()
and size() - 1
value
- value to put to the given indexdefault int setFrom(@NotNull java.lang.Iterable<? extends java.lang.Number> iterable)
Sizeable.size()
elements are set.iterable
- iterable from which this indexable is filleddefault int setFrom(@NotNull java.lang.Iterable<? extends java.lang.Number> iterable, int startIndex, int numElements)
numElements
elements are set.iterable
- iterable from which this indexable is filledstartIndex
- start index where the setting beginsnumElements
- number of elements to set@NotNull default MutableIntIndexable.Base subSet(int fromIndex, int toIndex)
IntIndexable
fromIndex
to toIndex - 1
.subSet
in interface IntIndexable
fromIndex
- start index of sub settoIndex
- index after last index@NotNull default MutableIntIndexable.Base sybSet(int fromIndex, int toIndex)
IntIndexable
sybSet
in interface IntIndexable
fromIndex
- start index of sub settoIndex
- end index of sub set@NotNull default MutableIntIndexable.Base tailSet(int fromIndex)
IntIndexable
tailSet
in interface IntIndexable
fromIndex
- index to start with, negative counts from the back@NotNull default MutableIntIndexable.Base headSet(int toIndex)
IntIndexable
headSet
in interface IntIndexable
toIndex
- index one after the end (equal to the length of the returned set),
negative counts from the back@NotNull default MutableIntIndexable.Base reverse()
IntIndexable
reverse
in interface IntIndexable
default void initByIndex(@NotNull java.util.function.IntUnaryOperator setter)
setter
- setter which provides the value to be set for a given index@NotNull default java.util.List<java.lang.Integer> asList()
List.set(int, Object)
method,
but neither any adding nor deleting methods. Standard sorting algorithms will work
on the returned list as a sorting algorithm is expected to neither move nor add
elements.asList
in interface IntIndexable
IntIndexable.toList()
@NotNull default MutableIntIndexable getCopy()
Copyable
getCopy
in interface Copyable<MutableIntIndexable>
@NotNull static MutableIntIndexable.Base based(@NotNull MutableIntIndexable indexable)
indexable
- mutqable int indexable to view as a MutableIntIndexable.Base
mutable int indexable@NotNull static MutableIntIndexable.Base init(int size, @NotNull java.util.function.IntSupplier creator)
size
- size of indexablecreator
- creator for the initial elementszeroed(int)
,
init(int, int)
@NotNull static MutableIntIndexable.Base copyOf(@NotNull java.util.Collection<? extends java.lang.Number> collection)
collection
- collection@NotNull static <IN> MutableIntIndexable.Base copy(@NotNull java.util.Collection<IN> collection, @NotNull java.util.function.Function<IN,java.lang.Number> copier)
IN
- incoming element typecollection
- collectioncopier
- element copier@NotNull static MutableIntIndexable.Base empty()
@NotNull static MutableIntIndexable.Base fromArray(@NotNull int... elements)
elements
- elementselements
@NotNull static MutableIntIndexable.Base fromArray(@NotNull int[] elements, int startIndex, int length)
elements
- array of elementsstartIndex
- index of first element used in the returned indxablelength
- length number of elements used in the returned indexableeleements
@NotNull static MutableIntIndexable.Base viewArray(@NotNull int[] array)
viewArray
in interface IntIndexable
array
- array@NotNull static MutableIntIndexable.Base viewList(@NotNull java.util.List<java.lang.Integer> list)
list
- list@NotNull static MutableIntIndexable.Base fromIndexable(@NotNull Indexable<? extends java.lang.Number> indexable)
indexable
- standard indexable@NotNull static <B> MutableIntIndexable.Base fromIndexable(@NotNull Indexable<B> indexable, @NotNull java.util.function.Function<? super B,? extends java.lang.Number> converter)
B
- element type of incoming idexableindexable
- base indexableconverter
- converter from base indexable type to result element type,@NotNull static <T> MutableIntIndexable.Base viewIndexable(@NotNull Indexable<T> indexable, @NotNull java.util.function.ToIntFunction<? super T> getter, @NotNull IntSetter<? super T> setter)
This is useful if you have complex items, but are interested into only one (int) property of each item.
T
- element type of the underlying indexableindexable
- underlying generic indexablegetter
- function used to extract the property of interestsetter
- procedure used to set the property of interest@NotNull static MutableIntIndexable.Base fromDoubleIndexable(@NotNull DoubleIndexable indexable)
indexable
- double indexable@NotNull static MutableIntIndexable.Base fromFloatIndexable(@NotNull FloatIndexable indexable)
indexable
- float indexable@NotNull static MutableIntIndexable.Base fromLongIndexable(@NotNull LongIndexable indexable)
indexable
- long indexable@NotNull static MutableIntIndexable.Base fromIntIndexable(@NotNull IntIndexable indexable)
indexable
- int indexable@NotNull static MutableIntIndexable.Base fromShortIndexable(@NotNull ShortIndexable indexable)
indexable
- short indexable@NotNull static MutableIntIndexable.Base fromByteIndexable(@NotNull ByteIndexable indexable)
indexable
- long indexable@NotNull static MutableIntIndexable.Base fromIterable(int size, @NotNull java.lang.Iterable<? extends java.lang.Number> iter)
size
- maximum size of returned indexableiter
- iterable used for initializing the indexable@NotNull static MutableIntIndexable.Base zeroed(int size)
size
0.0
elements.size
- required size of returned mutable int indexable0.0
init(int, int)
,
init(int, IntSupplier)
@NotNull static MutableIntIndexable.Base init(int size, int value)
init
in interface IntIndexable
size
- required size of returned mutable int indexablevalue
- initial value of all elementsvalue
init(int, IntSupplier)
,
zeroed(int)
@NotNull static MutableIntIndexable.Base initByIndex(int size, @NotNull java.util.function.IntUnaryOperator producer)
initByIndex
in interface IntIndexable
size
- size of the returned indexableproducer
- producer which is called with an index and expected to return the associated valueproducer
IntIndexable.viewByIndex(int, IntUnaryOperator)