public interface DoubleIndexable extends PrimitiveDoubleIterable, Sizeable
The EMPTY
constant or emptyIndexable()
method provide the same
useful return value to indicate emptiness.
Simple implementations should extend DoubleIndexable.Base
because
that provides useful implementations for standard Object methods and implements
Comparable
.
FastDoubleSequenceSearch
Modifier and Type | Interface and Description |
---|---|
static class |
DoubleIndexable.Base
Abstract base class which provides useful implementations
for
Object.equals(Object) , Object.hashCode() ,
Object.toString() . |
static class |
DoubleIndexable.DoubleIndexableSpliterator
Spliterator for double indexables.
|
Modifier and Type | Field and Description |
---|---|
static DoubleIndexable.Base |
EMPTY
An empty indexable.
|
static DoubleIndexable |
SINGLE_0
Double indexable which only contains the single value
0.0 . |
EMPTY_DOUBLE_ITERATOR
Modifier and Type | Method and Description |
---|---|
default void |
addAllTo(java.util.Collection<? super java.lang.Double> collection)
Add all elements of this indexable to the given collection.
|
default int |
addToArray(double[] array,
int pos)
Add the content of this indexable to the given array.
|
default int |
addToArray(double[] array,
int arrayPos,
int index,
int length)
Add a part of the content of this indexable to the given array.
|
default DoubleIndexable.Base |
asBase()
Make this double indexable usable as a base class with defined standard Object methods.
|
default java.util.Collection<java.lang.Double> |
asCollection()
Get a view on this indexable as an unmodifiable collection.
|
default Indexable<java.lang.Double> |
asIndexable()
Get a view of this indexable as a standard object-based indexable.
|
default java.util.List<java.lang.Double> |
asList()
Get a view on this indexable as an unmodifiable list.
|
default int |
binarySearch(double value)
Do a binary search in an indexable ordered in natural ascending order.
|
default int |
binarySearch(double value,
DoubleOrdering order)
Do a binary search in an ordered indexable.
|
static int |
compare(DoubleIndexable indexable1,
DoubleIndexable indexable2)
Compare two double indexables.
|
default DoubleIndexable |
deltas()
View the differences between consecutive elements as a new double indexable.
|
default java.util.PrimitiveIterator.OfDouble |
doubleIterator()
Get an primitive double iterator.
|
default java.util.PrimitiveIterator.OfDouble |
doubleIterator(int from,
int to)
Get a double iterator from the given sub set.
|
default java.util.Spliterator.OfDouble |
doubleSpliterator()
Get a spliterator on this indexable.
|
static DoubleIndexable.Base |
emptyIndexable()
Get an empty indexable set.
|
static boolean |
equal(DoubleIndexable indexable1,
DoubleIndexable indexable2)
Are two double indexables equal?
|
static boolean |
equal(DoubleIndexable indexable1,
DoubleIndexable indexable2,
DoublePredicate2 checker)
Are two double indexables equal?
|
static boolean |
equal(DoubleIndexable indexable1,
java.lang.Object indexable2)
Are two double indexables equal?
|
static boolean |
equalStandard(DoubleIndexable indexable1,
DoubleIndexable indexable2)
Are two double indexables equal?
|
default int |
firstMatch(java.util.function.DoublePredicate check)
Get the first index for which the given check is fulfilled.
|
default double |
firstValue()
Get the first value in this double indexable.
|
default double |
foldLeft(double initialValue,
java.util.function.DoubleBinaryOperator foldOperation)
Go over all values and do a cumulative calculation.
|
default DoubleIndexable |
frozen()
Get a frozen version of this indexable.
|
default java.util.Spliterator.OfDouble |
frozenDoubleSpliterator()
Get an immutable spliterator on a frozen copy of this indexable.
|
double |
get(int index)
Get the element at the given index.
|
default double |
gyt(int index)
Pythonesque get.
|
static int |
hash(DoubleIndexable indexable)
Calculate a hashcode for a double indexable.
|
default DoubleIndexable.Base |
headSet(int toIndex)
Create an indexable subset from the last elements of this indexable set.
|
default java.lang.Iterable<java.lang.Integer> |
indexes()
Get the indexes of this indexable as an iterable range.
|
static DoubleIndexable.Base |
init(int size,
double value)
Get a double indexable of a given size which always returns the same value.
|
static DoubleIndexable |
initByIndex(int size,
java.util.function.IntToDoubleFunction producer)
Get a double indexable of a given size which returns elements created by index.
|
default IntIndexable |
intIndexes()
Get the indexes of this indexable as an integer indexable.
|
default boolean |
isEmpty()
Is this indexable empty?
|
default boolean |
isOrdered(DoubleOrdering order)
Is this indexable sorted according to the given ordering?
|
default boolean |
isStrictlyOrdered(DoubleOrdering order)
Is this indexable strictly sorted according to the given ordering?
|
default java.util.Iterator<java.lang.Double> |
iterator()
Returns an iterator over elements of type
T . |
default int |
lastMatch(java.util.function.DoublePredicate check)
Get the last index for which the given check is fulfilled.
|
default double |
lastValue()
Get the last value in this double indexable.
|
default java.util.ListIterator<java.lang.Double> |
listIterator()
Returns a list iterator over elements of type
T . |
default int |
nextMatch(int startIndex,
java.util.function.DoublePredicate check)
Get the next index for which the given check is fulfilled.
|
default MutableDoubleIndexable |
ordered()
Create a (mutable) double indexable from the values of this indexable
which is ordered in natural order.
|
default MutableDoubleIndexable |
ordered(DoubleOrdering order)
Create a (mutable) double indexable from the values of this indexable
which is ordered as defined by the given ordering.
|
default int |
previousMatch(int startIndex,
java.util.function.DoublePredicate check)
Get the previous index for which the given check is fulfilled.
|
default DoubleIndexable.Base |
reverse()
Get this indexable but with inverted order.
|
default DoubleIndexable |
rotated(int steps)
Get a rotated view of this double indexable.
|
static DoubleIndexable.Base |
singleton(double value)
View a single double value as a double indexable of size 1.
|
default DoubleIndexable.Base |
subSet(int fromIndex,
int toIndex)
Get an indexable subset.
|
default DoubleIndexable.Base |
sybSet(int fromIndex,
int toIndex)
Get an indexable subset.
|
default DoubleIndexable.Base |
tailSet(int fromIndex)
Create an indexable subset from the last elements of this indexable set.
|
default double[] |
toArray()
Convert this indexable into a Java array.
|
default java.util.ArrayList<java.lang.Double> |
toList()
Create a list from this double indexable.
|
static java.lang.String |
toString(DoubleIndexable indexable)
Create a string representation of the given indexable.
|
default DoubleIndexable.Base |
transformed(DoubleOperator1 operator)
View the elements of this double indexable transformed.
|
default <T> Indexable<T> |
view(java.util.function.DoubleFunction<? extends T> convert)
View this as an indexable of another type.
|
static DoubleIndexable.Base |
viewArray(double... array)
View a double array as an Indexable.
|
static DoubleIndexable.Base |
viewArray(double[] array,
int start,
int length)
View part of a double array as an Indexable.
|
static <T> DoubleIndexable.Base |
viewArray(T[] array,
java.util.function.ToDoubleFunction<? super T> valueExtract)
View an object array as a double indexable.
|
static <T> DoubleIndexable.Base |
viewArray(java.util.function.ToDoubleFunction<? super T> extractor,
T... array)
View an array of a different type.
|
default BooleanIndexable |
viewAsBoolean(java.util.function.DoublePredicate convert)
View this indexable as a boolean indexable while using a conversion for
each value.
|
default ByteIndexable |
viewAsByte()
View this double indexable as a byte integer indexable.
|
default FloatIndexable |
viewAsFloat()
View this double indexable as a float indexable.
|
default IntIndexable |
viewAsInt()
View this double indexable as a short integer indexable.
|
default IntIndexable |
viewAsInt(java.util.function.DoubleToIntFunction convert)
View this indexable as an integer indexable while using a conversion for
each value.
|
default LongIndexable |
viewAsLong()
View this double indexable as a long integer indexable.
|
default LongIndexable |
viewAsLong(java.util.function.DoubleToLongFunction convert)
View this indexable as a long integer indexable while using a conversion for
each value.
|
default ShortIndexable |
viewAsShort()
View this double indexable as a short integer indexable.
|
static DoubleIndexable.Base |
viewByIndex(int size,
java.util.function.IntToDoubleFunction producer)
Get a double indexable of a given size which returns elements created by index.
|
static DoubleIndexable.Base |
viewIndexable(Indexable<? extends java.lang.Number> indexable)
View a generic Number indexable as double indexable.
|
static DoubleIndexable.Base |
viewIndexable(Indexable<? extends java.lang.Number> indexable,
double nullFallback)
View a generic Number indexable as double indexable.
|
static <T> DoubleIndexable.Base |
viewIndexable(Indexable<T> indexable,
java.util.function.ToDoubleFunction<? super T> extractor)
View a generic indexable as a double indexable.
|
static DoubleIndexable.Base |
viewList(java.util.List<? extends java.lang.Number> list)
View a list of numbers as a double indexable.
|
static DoubleIndexable.Base |
viewList(java.util.List<? extends java.lang.Number> list,
double nullValue)
View a list as an Indexable.
|
static <T> DoubleIndexable.Base |
viewList(java.util.List<T> list,
java.util.function.ToDoubleFunction<? super T> extractor)
View a generic list as a double indexable.
|
static DoubleIndexable.Base |
viewNumberArray(java.lang.Number... array)
View a Number array as an Indexable.
|
default DoubleIndexable |
viewOp(java.util.function.DoubleUnaryOperator op)
View this double indexable transformed by an operator.
|
default DoubleIndexable |
withAppendedValue(double value)
Create a view with of this indexable with another value added at the end.
|
static DoubleIndexable.Base |
withCachedHash(DoubleIndexable indexable)
Wrap an indexable with one which caches the hash value.
|
default DoubleIndexable |
withExchangedValueAt(int index,
double value)
Create a view of this double indexable with an exchanged value.
|
default DoubleIndexable |
withInsertedValueAt(int index,
double value)
Create a view of this double indexable with an inserted value.
|
default DoubleIndexable |
withRemovedValueAt(int index)
Create a view of this indexable with one value removed.
|
default DoubleIndexable |
withSwappedValuesAt(int index1,
int index2)
Create a view of this double indexable with two values swapped.
|
average, containsDouble, containsDouble, forEachDouble, forEachDoubleFragile, spliterator, stream, sum
static final DoubleIndexable SINGLE_0
0.0
.@NotNull static final DoubleIndexable.Base EMPTY
double get(int index)
index
- index between 0
and size() - 1
default double gyt(int index)
-1
references the last element, -2
its predecessor, and so on.index
- index between -size()
and size() - 1
@NotNull default DoubleIndexable.Base reverse()
default boolean isEmpty()
true
: there are no elements in this indexablefalse
: this indexable has elements@NotNull default java.util.PrimitiveIterator.OfDouble doubleIterator()
doubleIterator
in interface PrimitiveDoubleIterable
@NotNull default java.util.PrimitiveIterator.OfDouble doubleIterator(int from, int to)
from
- first index of iteratorto
- one past last index of iterator@NotNull default java.util.Iterator<java.lang.Double> iterator()
T
.iterator
in interface java.lang.Iterable<java.lang.Double>
iterator
in interface PrimitiveDoubleIterable
default double firstValue()
default double lastValue()
@NotNull default java.util.ListIterator<java.lang.Double> listIterator()
T
.@NotNull default DoubleIndexable.Base subSet(int fromIndex, int toIndex)
fromIndex
to toIndex - 1
.fromIndex
- start index of sub settoIndex
- index after last index@NotNull default DoubleIndexable.Base sybSet(int fromIndex, int toIndex)
fromIndex
- start index of sub settoIndex
- end index of sub set@NotNull default DoubleIndexable.Base tailSet(int fromIndex)
fromIndex
- index to start with, negative counts from the back@NotNull default DoubleIndexable.Base headSet(int toIndex)
toIndex
- index one after the end (equal to the length of the returned set),
negative counts from the back@NotNull default java.util.Collection<java.lang.Double> asCollection()
Collection.addAll(Collection)
.@NotNull default java.util.List<java.lang.Double> asList()
Collection.addAll(Collection)
.toList()
@NotNull default java.util.ArrayList<java.lang.Double> toList()
asList()
default void addAllTo(@NotNull java.util.Collection<? super java.lang.Double> collection)
collection
- collection to add to@NotNull default Indexable<java.lang.Double> asIndexable()
Double
values@NotNull default double[] toArray()
default int addToArray(@NotNull double[] array, int pos)
array
- array where the content is addedpos
- position in the array where the content of this indexable is addeddefault int addToArray(@NotNull double[] array, int arrayPos, int index, int length)
array
- array where the content is addedarrayPos
- position in hte array where the content is addedindex
- start index of this indexable which is added firstlength
- number of entries of this indexable added to the array@NotNull default java.lang.Iterable<java.lang.Integer> indexes()
intIndexes()
,
Range.indexes(int)
@NotNull default IntIndexable intIndexes()
indexes()
,
IntIndexable.rangeFromSize(int)
default double foldLeft(double initialValue, @NotNull java.util.function.DoubleBinaryOperator foldOperation)
Eg calculate the maximum of this indexable use
double max = indexable.foldLeft(Double.NEGATIVE_INFINITY, Math::max);
initialValue
- start value for the operation, will be returned if this iterable is emptyfoldOperation
- operation applied to each value, will get the accumulated value as its
first and the current element value as its second argument@NotNull default DoubleIndexable.Base transformed(@NotNull DoubleOperator1 operator)
operator
- transformer applied before doubles are returneddefault int nextMatch(int startIndex, @NotNull java.util.function.DoublePredicate check)
startIndex
- start index for checking, Pythonesque
indexing supportedcheck
- check to perform on elements of this indexable until true
startIndex
for which the check returns true
,
Pythonesque.UNMAPPABLE
if nonedefault int firstMatch(@NotNull java.util.function.DoublePredicate check)
check
- check to perform on elements of this indexable until true
true
,
-1
if nonedefault int previousMatch(int startIndex, @NotNull java.util.function.DoublePredicate check)
startIndex
- start index for checking, Pythonesque
indexing supportedcheck
- check to perform on elements of this indexable until true
startIndex
for which the check returns true
,
Pythonesque.UNMAPPABLE
if nonedefault int lastMatch(@NotNull java.util.function.DoublePredicate check)
check
- check to perform on elements of this indexable until true
true
,
-1
if none@NotNull default DoubleIndexable frozen()
Often Indexables are used as a view to underlying collections. Although this interface is immutable, the underlying colelction might nevertheless change. This copies the current state of this indexable into an unmodifiable state, and returns an Indexable which is stable in size and will return always the same element for a given index. Beware: it is still possible that any element itself changes when the elements are mutable.
Calling frozen()
again on the returned object will just return
the object itself, so you can safely call this method more than once.
@NotNull default java.util.Spliterator.OfDouble doubleSpliterator()
Spliterator.IMMUTABLE
flag set,
see frozenDoubleSpliterator()
for an alternative.@NotNull default java.util.Spliterator.OfDouble frozenDoubleSpliterator()
frozen()
returns this
)
then this is the same as PrimitiveDoubleIterable.spliterator()
with the difference that the spliterator
returned here will have its Spliterator.IMMUTABLE
flag set. If this is not immutable
a frozen copy will be created, and the spliterator will be operating on that. Please refer to
frozen()
to understand what level of immutabiliy it will provide.@NotNull default <T> Indexable<T> view(@NotNull java.util.function.DoubleFunction<? extends T> convert)
convert
function, but you can use
Countable.frozen()
on it to get a fix independent indexable object.T
- required typeconvert
- converter between double and the required type@NotNull default DoubleIndexable withInsertedValueAt(int index, double value)
ExpandableDoubleIndexable
if you want to carry out more
stuff like this.
As this creates a view of this indexable, changes to this indexable might result in a disaster when using the returned indexable!
index
- index where the value is inserted before the current index
(not Pythonesque, because it is possible to add an value at index == size()
,
and it is expected that most insertion will happen at 0 or at the end)value
- inserted value at that indexwithAppendedValue(double)
@NotNull default DoubleIndexable withAppendedValue(double value)
value
- value to addwithInsertedValueAt(int, double)
@NotNull default DoubleIndexable withExchangedValueAt(int index, double value)
ExpandableDoubleIndexable
if you want to carry out more
stuff like this.
As this creates a view of this indexable, changes to this indexable could lead to unexpected results when using the returned indexable!
index
- index where the element is exchanged, hiding the current element.
(Pythonesque)value
- exchanged value at that index@NotNull default DoubleIndexable withRemovedValueAt(int index)
index
- index of the removed value (Pythonesque)@NotNull default DoubleIndexable withSwappedValuesAt(int index1, int index2)
index1
- index of the first value (Pythonesque)index2
- index of the second value (Pythonesque)@NotNull default DoubleIndexable rotated(int steps)
steps
will rotate left, i.e. any index will be accessed
as if the number of steps is added before extraction (modulo length).
E.g. a rotation of -1
will return the last element when index 0
is
requested, and the first element for index 1
.steps
- steps to rotatefrozen()
to create an indexable which no longer depends on this one@NotNull default DoubleIndexable viewOp(@NotNull java.util.function.DoubleUnaryOperator op)
op
- transforming operator@NotNull default FloatIndexable viewAsFloat()
frozen()
on the result to create an independent copy
if this seems like a problem to you.@NotNull default LongIndexable viewAsLong()
frozen()
on the result to create an independent copy
if this seems like a problem to you.@NotNull default LongIndexable viewAsLong(@NotNull java.util.function.DoubleToLongFunction convert)
Use frozen()
on the result to decouple it from this indexable.
convert
- converter applied to each value of this indexable before
it is returned from the resulting indexable@NotNull default IntIndexable viewAsInt()
frozen()
on the result to create an independent copy
if this seems like a problem to you.@NotNull default IntIndexable viewAsInt(@NotNull java.util.function.DoubleToIntFunction convert)
Use frozen()
on the result to decouple it from this indexable.
convert
- converter applied to each value of this indexable before
it is returned from the resulting indexable@NotNull default ShortIndexable viewAsShort()
frozen()
on the result to create an independent copy
if this seems like a problem to you.@NotNull default ByteIndexable viewAsByte()
frozen()
on the result to create an independent copy
if this seems like a problem to you.@NotNull default BooleanIndexable viewAsBoolean(@NotNull java.util.function.DoublePredicate convert)
Use frozen()
on the result to decouple it from this indexable.
convert
- converter applied to each value of this indexable before
it is returned from the resulting indexable@NotNull default DoubleIndexable deltas()
0
the returned indexable will return
the difference between the element with index 1
and index 0
of this indexable.frozen()
if you plan to use it more than once.@NotNull static DoubleIndexable.Base viewList(@NotNull java.util.List<? extends java.lang.Number> list)
list
- list used as a base, required to have only non-null elements@NotNull static DoubleIndexable.Base viewList(@NotNull java.util.List<? extends java.lang.Number> list, double nullValue)
list
- list used as a base, required to have only non-null elementsnullValue
- value returned for null
elements in the list@NotNull static <T> DoubleIndexable.Base viewList(@NotNull java.util.List<T> list, @NotNull java.util.function.ToDoubleFunction<? super T> extractor)
T
- element type of listlist
- generic listextractor
- extractor function which extracts a double from the elements of list
list
@NotNull static DoubleIndexable.Base viewIndexable(@NotNull Indexable<? extends java.lang.Number> indexable)
indexable
- generic indexable with Number elements, required to have only non-null elements@NotNull static DoubleIndexable.Base viewIndexable(@NotNull Indexable<? extends java.lang.Number> indexable, double nullFallback)
indexable
- generic indexable with Number elementsnullFallback
- fallback for null
elements@NotNull static <T> DoubleIndexable.Base viewIndexable(@NotNull Indexable<T> indexable, @NotNull java.util.function.ToDoubleFunction<? super T> extractor)
T
- element type of indexableindexable
- generic indexableextractor
- extractor function which extracts a double from the elements of indexable
indexable
@NotNull static DoubleIndexable.Base viewNumberArray(@NotNull java.lang.Number... array)
subSet(int, int)
.array
- array used as base, required to hold only non-null values@NotNull static DoubleIndexable.Base viewArray(@NotNull double... array)
viewArray(double[], int, int)
.array
- array used as base@NotNull static DoubleIndexable.Base viewArray(@NotNull double[] array, int start, int length)
array
- array used as basestart
- index of first byte to use from the arraylength
- number of elements to use from the array@NotNull static <T> DoubleIndexable.Base viewArray(@NotNull T[] array, @NotNull java.util.function.ToDoubleFunction<? super T> valueExtract)
T
- array element typearray
- viewed arrayvalueExtract
- converter from array elements to the double values of this indexable@NotNull @SafeVarargs static <T> DoubleIndexable.Base viewArray(@NotNull java.util.function.ToDoubleFunction<? super T> extractor, T... array)
T
- array typeextractor
- function used to extract the double value from the different typearray
- array of a different type@NotNull static DoubleIndexable.Base init(int size, double value)
size
- size of the returned indexablevalue
- value returned for each elementsize
with always the same element@NotNull static DoubleIndexable.Base viewByIndex(int size, @NotNull java.util.function.IntToDoubleFunction producer)
producer
when an element is requested.
Use frozen()
on the result to create an indexable which avoids this.size
- size of the returned indexableproducer
- producer which is called with an index and expected to return the associated valueproducer
with the given index when an element is requestedinitByIndex(int, IntToDoubleFunction)
@NotNull static DoubleIndexable initByIndex(int size, @NotNull java.util.function.IntToDoubleFunction producer)
size
- size of the returned indexableproducer
- producer which is called with an index and expected to return the associated valueproducer
viewByIndex(int, IntToDoubleFunction)
@NotNull static DoubleIndexable.Base singleton(double value)
value
- single value@NotNull static DoubleIndexable.Base emptyIndexable()
@NotNull static java.lang.String toString(@NotNull DoubleIndexable indexable)
indexable
- indexablestatic boolean equal(@NotNull DoubleIndexable indexable1, @NotNull DoubleIndexable indexable2)
This handles NaN values specially so that two of them are considered equal,
compare DoublePredicate2.EQUAL_EVEN_NAN
.
indexable1
- first indexableindexable2
- second indexabletrue
if both indexables contain the same values in the same sequencefalse
if sizes or values differstatic boolean equalStandard(@NotNull DoubleIndexable indexable1, @NotNull DoubleIndexable indexable2)
This handles NaN values according to the standard so that two of them are considered non-equal,
compare DoublePredicate2.EQUAL_STANDARD
.
indexable1
- first indexableindexable2
- second indexabletrue
if both indexables contain the same values in the same sequencefalse
if sizes or values differstatic boolean equal(@NotNull DoubleIndexable indexable1, @NotNull DoubleIndexable indexable2, @NotNull DoublePredicate2 checker)
indexable1
- first indexableindexable2
- second indexablechecker
- equality checker, this can be DoublePredicate2.EQUAL_STANDARD
pr
DoublePredicate2.EQUAL_EVEN_NAN
which handle NaN differently,
or allow for a small epsilon differencetrue
if both indexables contain the same values as defined by the checker in the same sequencefalse
if sizes or values differstatic boolean equal(@NotNull DoubleIndexable indexable1, @Nullable java.lang.Object indexable2)
Object.equals(Object)
method.indexable1
- first indexableindexable2
- object expected to be an indexable itselftrue
if both indexables contain the same values in the same sequencefalse
if the second object is not an indexable, of if sizes or values differstatic int compare(@NotNull DoubleIndexable indexable1, @NotNull DoubleIndexable indexable2)
Double.compareTo(Double)
until either the first difference is found (smaller of the two
values define the lower indexable) or the end of one is met
(shorter indexable is less).indexable1
- first indexableindexable2
- second indexable< 0>
if indexable1 < indxable2
,
0
if indexable1 == indexable2
, or
> 0
if indexable1 > indexable2
static int hash(@NotNull DoubleIndexable indexable)
indexable
- indexable for which the hash code is required@NotNull static DoubleIndexable.Base withCachedHash(@NotNull DoubleIndexable indexable)
The wrapped indexable must not change after it is wrapped, otherwise strange things are expected to happen.
indexable
- wrapped indexable, must not changeindexable
, but also provides
useful implementations for Object.hashCode()
, Object.equals(Object)
,
and Object.toString()
default boolean isOrdered(@NotNull DoubleOrdering order)
order
- expected orderingtrue
if this indexable is sorted as defined by order
false
if notdefault boolean isStrictlyOrdered(@NotNull DoubleOrdering order)
order
- expected orderingtrue
if this indexable is sorted as defined by order
false
if notdefault int binarySearch(double value)
standard Java ascending order
,
i.e. isOrdered(DoubleOrdering) has to return true
for this ordering.
For efficiency this prerequisite is not checked, but not fulfilling
it will make this method return bogus results. If this indexable is only ordered,
but not strictly ordered
it is not defined
which index is returned when the looked up value appears in a sequence of equal values.value
- value to look up-(insertIndex + 1)
.default int binarySearch(double value, @NotNull DoubleOrdering order)
order
,
i.e. isOrdered(DoubleOrdering) has to return true
for this order.
For efficiency this prerequisite is not checked, but not fulfilling
it will make this method return bogus results. If this indexable is only ordered,
but not strictly ordered
it is not defined
which index is returned when the looked up value appears in a sequence of equal values.value
- value to look uporder
- sort order-(insertIndex + 1)
.@NotNull default MutableDoubleIndexable ordered(@NotNull DoubleOrdering order)
If natural ordering is required prefer calling ordered()
because that typically runs 1.5 times faster.
order
- sort order@NotNull default MutableDoubleIndexable ordered()
This can be some 1.5x faster than using ordered(DoubleOrdering)
with standard Java order
.
@NotNull default DoubleIndexable.Base asBase()