public interface MutableDoubleIndexable extends DoubleIndexable, Copyable<MutableDoubleIndexable>
double[]
as it eg allows
read-only views or transparent views of subsets of the array.Modifier and Type | Interface and Description |
---|---|
static class |
MutableDoubleIndexable.Base
Abstract base class which provides useful implementations
for
Object.equals(Object) , Object.hashCode() ,
Object.toString() . |
DoubleIndexable.DoubleIndexableSpliterator
Modifier and Type | Field and Description |
---|---|
static MutableDoubleIndexable.Base |
EMPTY
Empty mutable indexable.
|
SINGLE_0
EMPTY_DOUBLE_ITERATOR
Modifier and Type | Method and Description |
---|---|
default java.util.List<java.lang.Double> |
asList()
View this indexable as a standard list.
|
static MutableDoubleIndexable.Base |
based(MutableDoubleIndexable indexable)
View any mutable double indexable as a base double indexable.
|
static <IN> MutableDoubleIndexable.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 MutableDoubleIndexable.Base |
copyOf(java.util.Collection<? extends java.lang.Number> collection)
Create a mutable indexable which is initialized from a
given collection.
|
static MutableDoubleIndexable.Base |
empty() |
static MutableDoubleIndexable.Base |
fromArray(double... elements)
Create a mutable indexable which is initialized from eleemnts
of the given array.
|
static MutableDoubleIndexable.Base |
fromArray(double[] elements,
int startIndex,
int length)
Create a mutable indexable which is initialized from elements
of the given array.
|
static MutableDoubleIndexable.Base |
fromByteIndexable(ByteIndexable indexable)
Return a mutable double indexable initialized with the content of a
standard byte indexable.
|
static MutableDoubleIndexable.Base |
fromDoubleIndexable(DoubleIndexable indexable)
Return a mutable double indexable initialized with the content of a
standard double indexable.
|
static MutableDoubleIndexable.Base |
fromFloatIndexable(FloatIndexable indexable)
Return a mutable double indexable initialized with the content of a
standard float indexable.
|
static MutableDoubleIndexable.Base |
fromIndexable(Indexable<? extends java.lang.Number> indexable)
Create a mutable indexable which is the copy of a standard indexable.
|
static <B> MutableDoubleIndexable.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 MutableDoubleIndexable.Base |
fromIntIndexable(IntIndexable indexable)
Return a mutable double indexable initialized with the content of a
standard int indexable.
|
static MutableDoubleIndexable.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 MutableDoubleIndexable.Base |
fromLongIndexable(LongIndexable indexable)
Return a mutable double indexable initialized with the content of a
standard long indexable.
|
static MutableDoubleIndexable.Base |
fromShortIndexable(ShortIndexable indexable)
Return a mutable double indexable initialized with the content of a
standard short indexable.
|
default MutableDoubleIndexable |
getCopy()
Get a copy of this object.
|
default MutableDoubleIndexable.Base |
headSet(int toIndex)
Create an indexable subset from the last elements of this indexable set.
|
static MutableDoubleIndexable.Base |
init(int size,
double value)
Create a mutable
|
static MutableDoubleIndexable.Base |
init(int size,
java.util.function.DoubleSupplier creator)
Initialize a mutable indexable to a given size.
|
static MutableDoubleIndexable.Base |
initByIndex(int size,
java.util.function.IntToDoubleFunction producer)
Get a mutable double indexable of a given size which contains elements created by index.
|
default void |
initByIndex(java.util.function.IntToDoubleFunction setter)
Set all values of this double indexable by index.
|
default MutableDoubleIndexable.Base |
reverse()
Get this indexable but with inverted order.
|
void |
set(int index,
double 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 double 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 double indexable one after
the other from the given iterable until either the
iterable is emptied or
numElements elements are set. |
default MutableDoubleIndexable.Base |
subSet(int fromIndex,
int toIndex)
Get an indexable subset.
|
default MutableDoubleIndexable.Base |
sybSet(int fromIndex,
int toIndex)
Get an indexable subset.
|
default void |
syt(int index,
double value)
Pythonesque set.
|
default MutableDoubleIndexable.Base |
tailSet(int fromIndex)
Create an indexable subset from the last elements of this indexable set.
|
static MutableDoubleIndexable.Base |
viewArray(double... array)
Mutable indexable view which operates on the given array.
|
static <T> MutableDoubleIndexable.Base |
viewIndexable(Indexable<T> indexable,
java.util.function.ToDoubleFunction<? super T> getter,
DoubleSetter<? super T> setter)
View a generic indexable as a mutable double indexable by accessing
a double property of the elements of the underlying generic indexable.
|
static MutableDoubleIndexable.Base |
viewList(java.util.List<java.lang.Double> list)
Mutable indexable view which operates on the given array.
|
static MutableDoubleIndexable.Base |
zeroed(int size)
Create a mutable double indexable with
size
0.0 elements. |
addAllTo, addToArray, addToArray, asBase, asCollection, asIndexable, compare, deltas, doubleIterator, doubleIterator, doubleSpliterator, emptyIndexable, equal, equal, equal, equalStandard, firstMatch, foldLeft, frozen, frozenDoubleSpliterator, get, gyt, hash, indexes, intIndexes, isEmpty, iterator, lastMatch, listIterator, nextMatch, previousMatch, rotated, singleton, toArray, toList, toString, transformed, view, viewArray, viewArray, viewAsBoolean, viewAsByte, viewAsFloat, viewAsInt, viewAsInt, viewAsLong, viewAsLong, viewAsShort, viewByIndex, viewIndexable, viewIndexable, viewIndexable, viewList, viewList, viewList, viewNumberArray, withAppendedValue, withCachedHash, withExchangedValueAt, withInsertedValueAt, withRemovedValueAt, withSwappedValuesAt
average, containsDouble, containsDouble, forEachDouble, forEachDoubleFragile, spliterator, stream, sum
static final MutableDoubleIndexable.Base EMPTY
empty()
instead.void set(int index, double value)
index
- index between 0
and size() - 1
value
- value to put to the given indexdefault void syt(int index, double 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 MutableDoubleIndexable.Base subSet(int fromIndex, int toIndex)
DoubleIndexable
fromIndex
to toIndex - 1
.subSet
in interface DoubleIndexable
fromIndex
- start index of sub settoIndex
- index after last index@NotNull default MutableDoubleIndexable.Base sybSet(int fromIndex, int toIndex)
DoubleIndexable
sybSet
in interface DoubleIndexable
fromIndex
- start index of sub settoIndex
- end index of sub set@NotNull default MutableDoubleIndexable.Base tailSet(int fromIndex)
DoubleIndexable
tailSet
in interface DoubleIndexable
fromIndex
- index to start with, negative counts from the back@NotNull default MutableDoubleIndexable.Base headSet(int toIndex)
DoubleIndexable
headSet
in interface DoubleIndexable
toIndex
- index one after the end (equal to the length of the returned set),
negative counts from the back@NotNull default MutableDoubleIndexable.Base reverse()
DoubleIndexable
reverse
in interface DoubleIndexable
default void initByIndex(@NotNull java.util.function.IntToDoubleFunction setter)
setter
- setter which provides the value to be set for a given index@NotNull default java.util.List<java.lang.Double> 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 DoubleIndexable
DoubleIndexable.toList()
@NotNull default MutableDoubleIndexable getCopy()
Copyable
getCopy
in interface Copyable<MutableDoubleIndexable>
@NotNull static MutableDoubleIndexable.Base based(@NotNull MutableDoubleIndexable indexable)
indexable
- mutqable double indexable to view as a MutableDoubleIndexable.Base
mutable double indexable@NotNull static MutableDoubleIndexable.Base init(int size, @NotNull java.util.function.DoubleSupplier creator)
size
- size of indexablecreator
- creator for the initial elementszeroed(int)
,
init(int, double)
@NotNull static MutableDoubleIndexable.Base copyOf(@NotNull java.util.Collection<? extends java.lang.Number> collection)
collection
- collection@NotNull static <IN> MutableDoubleIndexable.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 MutableDoubleIndexable.Base empty()
@NotNull static MutableDoubleIndexable.Base fromArray(@NotNull double... elements)
elements
- elementselements
@NotNull static MutableDoubleIndexable.Base fromArray(@NotNull double[] 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 MutableDoubleIndexable.Base viewArray(@NotNull double... array)
viewArray
in interface DoubleIndexable
array
- array@NotNull static MutableDoubleIndexable.Base viewList(@NotNull java.util.List<java.lang.Double> list)
list
- list@NotNull static <T> MutableDoubleIndexable.Base viewIndexable(@NotNull Indexable<T> indexable, @NotNull java.util.function.ToDoubleFunction<? super T> getter, @NotNull DoubleSetter<? super T> setter)
This is useful if you have complex items, but are interested into only one (double) 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 MutableDoubleIndexable.Base fromIndexable(@NotNull Indexable<? extends java.lang.Number> indexable)
indexable
- standard indexable@NotNull static <B> MutableDoubleIndexable.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 MutableDoubleIndexable.Base fromDoubleIndexable(@NotNull DoubleIndexable indexable)
indexable
- double indexable@NotNull static MutableDoubleIndexable.Base fromFloatIndexable(@NotNull FloatIndexable indexable)
indexable
- float indexable@NotNull static MutableDoubleIndexable.Base fromLongIndexable(@NotNull LongIndexable indexable)
indexable
- long indexable@NotNull static MutableDoubleIndexable.Base fromIntIndexable(@NotNull IntIndexable indexable)
indexable
- int indexable@NotNull static MutableDoubleIndexable.Base fromShortIndexable(@NotNull ShortIndexable indexable)
indexable
- long indexable@NotNull static MutableDoubleIndexable.Base fromByteIndexable(@NotNull ByteIndexable indexable)
indexable
- long indexable@NotNull static MutableDoubleIndexable.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 MutableDoubleIndexable.Base zeroed(int size)
size
0.0
elements.size
- required size of returned mutable double indexable0.0
init(int, double)
,
init(int, DoubleSupplier)
@NotNull static MutableDoubleIndexable.Base init(int size, double value)
init
in interface DoubleIndexable
size
- required size of returned mutable double indexablevalue
- initial value of all elementsvalue
init(int, DoubleSupplier)
,
zeroed(int)
@NotNull static MutableDoubleIndexable.Base initByIndex(int size, @NotNull java.util.function.IntToDoubleFunction producer)
initByIndex
in interface DoubleIndexable
size
- size of the returned indexableproducer
- producer which is called with an index and expected to return the associated valueproducer
DoubleIndexable.viewByIndex(int, IntToDoubleFunction)