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