public interface MutableFloatIndexable extends FloatIndexable, Copyable<MutableFloatIndexable>
float[]
as it eg allows
read-only views or transparent views of subsets of the array.Modifier and Type | Interface and Description |
---|---|
static class |
MutableFloatIndexable.Base
Abstract base class which provides useful implementations
for
Object.equals(Object) , Object.hashCode() ,
Object.toString() . |
Modifier and Type | Field and Description |
---|---|
static MutableFloatIndexable.Base |
EMPTY
Empty mutable indexable.
|
SINGLE_0
EMPTY_FLOAT_ITERATOR
Modifier and Type | Method and Description |
---|---|
default java.util.List<java.lang.Float> |
asList()
View this indexable as a standard list.
|
static MutableFloatIndexable.Base |
based(MutableFloatIndexable indexable)
View any mutable float indexable as a base float indexable.
|
static <IN> MutableFloatIndexable.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.
|
default void |
copyInternally(int fromIndex,
int toIndex,
int numElements)
Copy elements inside this indexable.
|
static MutableFloatIndexable.Base |
copyOf(java.util.Collection<? extends java.lang.Number> collection)
Create a mutable indexable which is initialized from a
given collection.
|
static MutableFloatIndexable.Base |
empty() |
default void |
fillFrom(IntToFloatFunction1 provider)
Fill this indexable from a provider.
|
static MutableFloatIndexable.Base |
fromArray(float... elements)
Create a mutable indexable which is initialized from elements
of the given array.
|
static MutableFloatIndexable.Base |
fromArray(float[] elements,
int startIndex,
int length)
Create a mutable indexable which is initialized from elements
of the given array.
|
static MutableFloatIndexable.Base |
fromByteIndexable(ByteIndexable indexable)
Return a mutable double indexable initialized with the content of a
standard byte indexable.
|
static MutableFloatIndexable.Base |
fromDoubleIndexable(DoubleIndexable indexable)
Return a mutable float indexable initialized with the content of a
standard double indexable.
|
static MutableFloatIndexable.Base |
fromFloatIndexable(FloatIndexable indexable)
Return a mutable float indexable initialized with the content of a
standard float indexable.
|
static MutableFloatIndexable.Base |
fromIndexable(Indexable<? extends java.lang.Number> indexable)
Create a mutable indexable which is the copy of a standard indexable.
|
static <B> MutableFloatIndexable.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 MutableFloatIndexable.Base |
fromIntIndexable(IntIndexable indexable)
Return a mutable float indexable initialized with the content of a
standard int indexable.
|
static MutableFloatIndexable.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 MutableFloatIndexable.Base |
fromLongIndexable(LongIndexable indexable)
Return a mutable float indexable initialized with the content of a
standard long indexable.
|
static MutableFloatIndexable.Base |
fromShortIndexable(ShortIndexable indexable)
Return a mutable long indexable initialized with the content of a
standard short indexable.
|
default MutableFloatIndexable |
getCopy()
Get a copy of this object.
|
default MutableFloatIndexable.Base |
headSet(int toIndex)
Create an indexable subset from the last elements of this indexable set.
|
static MutableFloatIndexable.Base |
init(int size,
float value)
Create a mutable
|
static MutableFloatIndexable.Base |
init(int size,
java.util.function.Supplier<? extends java.lang.Number> creator)
Initialize a mutable indexable to a given size.
|
static MutableFloatIndexable.Base |
initByIndex(int size,
IntToFloatFunction1 producer)
Get a mutable float indexable of a given size which contains elements created by index.
|
default void |
initByIndex(IntToFloatFunction1 setter)
Deprecated.
use
fillFrom(IntToFloatFunction1) instead |
default void |
order()
Order the elements in this indexable in their standard Java order.
|
default void |
order(FloatOrdering ordering)
Order the elements in this indexable by the given ordering.
|
default MutableFloatIndexable.Base |
reverse()
Get this indexable but with inverted order.
|
default void |
revert()
Revert the elements in this indexable.
|
default void |
revert(int from,
int to)
Revert the order of all elements in the given range.
|
void |
set(int index,
float 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 float 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 float indexable one after
the other from the given iterable until either the
iterable is emptied or
numElements elements are set. |
default void |
setFromArray(float[] array,
int arrayIndex,
int startIndex,
int numElements)
Set consecutive entries from an array.
|
default void |
setMulti(int from,
int len,
float value)
Set multiple elements to the same value.
|
default void |
shuffle(java.util.Random random)
Randomize the content of this mutable indexable.
|
default MutableFloatIndexable.Base |
subSet(int fromIndex,
int toIndex)
Get an indexable subset.
|
default void |
swap(int idx1,
int idx2)
Swap the values at two indices.
|
default void |
swyp(int idx1,
int idx2)
Swap the values at two indices using Pythonesque indices.
|
default MutableFloatIndexable.Base |
sybSet(int fromIndex,
int toIndex)
Get an indexable subset.
|
default void |
syt(int index,
float value)
Pythonesque set.
|
default MutableFloatIndexable.Base |
tailSet(int fromIndex)
Create an indexable subset from the last elements of this indexable set.
|
static MutableFloatIndexable.Base |
viewArray(float[] array)
Mutable indexable view which operates on the given array.
|
static MutableFloatIndexable.Base |
viewArray(float[] array,
int start,
int length)
Mutable indexable view which operates on a part of the given array.
|
static <T> MutableFloatIndexable.Base |
viewIndexable(Indexable<T> indexable,
ToFloatFunction<? super T> getter,
FloatSetter<? super T> setter)
View a generic indexable as a mutable float indexable by accessing
a float property of the elements of the underlying generic indexable.
|
static MutableFloatIndexable.Base |
viewList(java.util.List<java.lang.Float> list)
Mutable indexable view which operates on the given array.
|
static MutableFloatIndexable.Base |
zeroed(int size)
Create a mutable float indexable with
size
0.0 elements. |
addAllTo, addToArray, addToArray, asBase, asCollection, asDoubleIndexable, asIndexable, based, binarySearch, binarySearch, compare, doubleIterator, emptyIndexable, equal, equal, equal, equalStandard, firstMatch, floatIterator, floatIterator, foldLeft, frozen, get, getMod, gyt, hash, indexes, intIndexes, isEmpty, isOrdered, isStrictlyOrdered, iterator, lastMatch, listIterator, nextMatch, ordered, ordered, previousMatch, rotated, singleton, toArray, toList, toString, view, viewArray, viewAsBoolean, viewAsByte, viewAsDouble, viewAsInt, viewAsLong, viewAsShort, viewByIndex, viewIndexable, viewIndexable, viewIndexable, viewList, viewList, viewList, viewNumberArray, viewOp, withAppendedValue, withCachedHash, withExchangedValueAt, withInsertedValueAt, withRemovedValueAt, withSwappedValuesAt
asDoubleIterable, containsFloat, containsFloat, forEachFloat, forEachFloatFragile
static final MutableFloatIndexable.Base EMPTY
empty()
instead.void set(int index, float value)
index
- index between 0
and size() - 1
value
- value to put to the given indexdefault void syt(int index, float 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 setdefault void setFromArray(@NotNull float[] array, int arrayIndex, int startIndex, int numElements)
array
- array with elements to set fromarrayIndex
- start index in the arraystartIndex
- start index in this mutable indexablenumElements
- number of elements to copyjava.lang.IndexOutOfBoundsException
- if this mutable indexable would overflow by this operationjava.lang.ArrayIndexOutOfBoundsException
- if array overflows by this operationdefault void setMulti(int from, int len, float value)
from
- first index to be set (Pythonesque)len
- number of elements to be set (non-negative)value
- value to be setdefault void copyInternally(int fromIndex, int toIndex, int numElements)
fromIndex
- start index from where elements are copied (Pythonesque)toIndex
- start index to where elements are copied (Pythonesque)numElements
- number of elements to copydefault void fillFrom(@NotNull IntToFloatFunction1 provider)
provider
- provider which is called for each index and provides the element for that indexdefault void swap(int idx1, int idx2)
idx1
- first indexidx2
- second indexdefault void swyp(int idx1, int idx2)
idx1
- first index (Pythonesque
)idx2
- second index (Pythonesque
)@NotNull default MutableFloatIndexable.Base subSet(int fromIndex, int toIndex)
FloatIndexable
fromIndex
to toIndex - 1
.subSet
in interface FloatIndexable
fromIndex
- start index of sub settoIndex
- index after last index@NotNull default MutableFloatIndexable.Base sybSet(int fromIndex, int toIndex)
FloatIndexable
sybSet
in interface FloatIndexable
fromIndex
- start index of sub settoIndex
- end index of sub set@NotNull default MutableFloatIndexable.Base tailSet(int fromIndex)
FloatIndexable
tailSet
in interface FloatIndexable
fromIndex
- index to start with, negative counts from the back@NotNull default MutableFloatIndexable.Base headSet(int toIndex)
FloatIndexable
headSet
in interface FloatIndexable
toIndex
- index one after the end (equal to the length of the returned set),
negative counts from the back@NotNull default MutableFloatIndexable.Base reverse()
FloatIndexable
reverse
in interface FloatIndexable
default void revert(int from, int to)
to
element is also included in the reversion to allow easy
reversion at the end by using -1
.from
- start element of reversion (Pythonesque), includedto
- end element of reversion (Pythonesque), includeddefault void revert()
default void order(@NotNull FloatOrdering ordering)
FloatIndexable.isOrdered(FloatOrdering)
returns true
for the given ordering
.
If natural ordering is required use order()
because in many cases this can avoid the overhead of an ordering
and sort much faster (typically 1.5x as fast).
ordering
- ordering to applydefault void order()
order(FloatOrdering)
with natural order
.default void shuffle(@NotNull java.util.Random random)
random
- random number generator@Deprecated default void initByIndex(@NotNull IntToFloatFunction1 setter)
fillFrom(IntToFloatFunction1)
insteadsetter
- setter which provides the value to be set for a given index@NotNull default java.util.List<java.lang.Float> 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 FloatIndexable
FloatIndexable.toList()
@NotNull default MutableFloatIndexable getCopy()
Copyable
getCopy
in interface Copyable<MutableFloatIndexable>
@NotNull static MutableFloatIndexable.Base based(@NotNull MutableFloatIndexable indexable)
indexable
- mutqable float indexable to view as a MutableFloatIndexable.Base
mutable float indexable@NotNull static MutableFloatIndexable.Base init(int size, @NotNull java.util.function.Supplier<? extends java.lang.Number> creator)
size
- size of indexablecreator
- creator for the initial elementszeroed(int)
,
init(int, float)
@NotNull static MutableFloatIndexable.Base copyOf(@NotNull java.util.Collection<? extends java.lang.Number> collection)
collection
- collection@NotNull static <IN> MutableFloatIndexable.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 MutableFloatIndexable.Base empty()
@NotNull static MutableFloatIndexable.Base fromArray(@NotNull float... elements)
elements
- elementselements
@NotNull static MutableFloatIndexable.Base fromArray(@NotNull float[] 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 indexableelements
@NotNull static MutableFloatIndexable.Base viewArray(@NotNull float[] array)
viewArray
in interface FloatIndexable
array
- array@NotNull static MutableFloatIndexable.Base viewArray(@NotNull float[] array, int start, int length)
viewArray
in interface FloatIndexable
array
- arraystart
- start position in arraylength
- length of returned indexable@NotNull static MutableFloatIndexable.Base viewList(@NotNull java.util.List<java.lang.Float> list)
list
- list@NotNull static MutableFloatIndexable.Base fromIndexable(@NotNull Indexable<? extends java.lang.Number> indexable)
indexable
- standard indexable@NotNull static <B> MutableFloatIndexable.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 MutableFloatIndexable.Base fromDoubleIndexable(@NotNull DoubleIndexable indexable)
indexable
- double indexable@NotNull static MutableFloatIndexable.Base fromFloatIndexable(@NotNull FloatIndexable indexable)
indexable
- float indexable@NotNull static MutableFloatIndexable.Base fromLongIndexable(@NotNull LongIndexable indexable)
indexable
- long indexable@NotNull static MutableFloatIndexable.Base fromIntIndexable(@NotNull IntIndexable indexable)
indexable
- int indexable@NotNull static MutableFloatIndexable.Base fromShortIndexable(@NotNull ShortIndexable indexable)
indexable
- short indexable@NotNull static MutableFloatIndexable.Base fromByteIndexable(@NotNull ByteIndexable indexable)
indexable
- long indexable@NotNull static MutableFloatIndexable.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 <T> MutableFloatIndexable.Base viewIndexable(@NotNull Indexable<T> indexable, @NotNull ToFloatFunction<? super T> getter, @NotNull FloatSetter<? super T> setter)
This is useful if you have complex items, but are interested into only one (float) 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 MutableFloatIndexable.Base zeroed(int size)
size
0.0
elements.size
- required size of returned mutable float indexable0.0
init(int, float)
,
init(int, Supplier)
@NotNull static MutableFloatIndexable.Base init(int size, float value)
init
in interface FloatIndexable
size
- required size of returned mutable float indexablevalue
- initial value of all elementsvalue
init(int, Supplier)
,
zeroed(int)
@NotNull static MutableFloatIndexable.Base initByIndex(int size, @NotNull IntToFloatFunction1 producer)
initByIndex
in interface FloatIndexable
size
- size of the returned indexableproducer
- producer which is called with an index and expected to return the associated valueproducer
FloatIndexable.viewByIndex(int, IntToFloatFunction1)