public class FloatMap<V> extends ISortedMap.Mixin<Double,V>
IntMap
, with which it shares performance characteristics.
Since this is intended foremost as a sorted data structure, it does not allow NaN
and treats -0.0
as
equivalent to 0.0
. Anyone looking for identity-based semantics should use a normal Map
instead.
ISortedMap.Mixin<K,V>
IMap.Durable<K,V>
Modifier and Type | Field and Description |
---|---|
IntMap<V> |
map |
hash
Constructor and Description |
---|
FloatMap() |
Modifier and Type | Method and Description |
---|---|
OptionalLong |
ceilIndex(double key) |
OptionalLong |
ceilIndex(Double key) |
FloatMap<V> |
clone() |
Comparator<Double> |
comparator() |
boolean |
contains(double key) |
FloatMap<V> |
difference(IMap<Double,?> b) |
FloatMap<V> |
difference(ISet<Double> keys) |
IList<IEntry<Double,V>> |
entries() |
boolean |
equals(IMap<Double,V> o,
BiPredicate<V,V> valEquals) |
boolean |
equals(Object obj) |
OptionalLong |
floorIndex(double key) |
FloatMap<V> |
forked()
This returns a data structure which is forked, which is equivalent to Clojure's persistent
data structures, also sometimes called functional or immutable.
|
static <V> FloatMap<V> |
from(Collection<Map.Entry<Number,V>> collection) |
static <V> FloatMap<V> |
from(IList<IEntry<Number,V>> list) |
static <V> FloatMap<V> |
from(IMap<Number,V> m) |
static <V> FloatMap<V> |
from(Map<Number,V> m) |
Optional<V> |
get(double key) |
V |
get(double key,
V defaultValue) |
V |
get(Double key,
V defaultValue) |
OptionalLong |
inclusiveFloorIndex(Double key) |
OptionalLong |
indexOf(double key) |
OptionalLong |
indexOf(Double key) |
FloatMap<V> |
intersection(IMap<Double,?> b) |
FloatMap<V> |
intersection(ISet<Double> keys) |
boolean |
isLinear() |
BiPredicate<Double,Double> |
keyEquality() |
ToLongFunction<Double> |
keyHash() |
FloatMap<V> |
linear()
This returns a data structure which is linear, or temporarily mutable.
|
<U> FloatMap<U> |
mapValues(BiFunction<Double,V,U> f) |
FloatMap<V> |
merge(IMap<Double,V> b,
BinaryOperator<V> mergeFn) |
IEntry<Double,V> |
nth(long idx) |
FloatMap<V> |
put(double key,
V value) |
FloatMap<V> |
put(Double key,
V value) |
FloatMap<V> |
put(double key,
V value,
BinaryOperator<V> merge) |
FloatMap<V> |
put(Double key,
V value,
BinaryOperator<V> merge) |
FloatMap<V> |
put(double key,
V value,
BinaryOperator<V> merge,
Object editor) |
FloatMap<V> |
put(double key,
V value,
Object editor) |
FloatMap<V> |
remove(double key) |
FloatMap<V> |
remove(Double key) |
FloatMap<V> |
remove(double key,
Object editor) |
long |
size() |
FloatMap<V> |
slice(double min,
double max) |
FloatMap<V> |
sliceReal(Double min,
Double max) |
List<FloatMap<V>> |
split(int parts)
Splits the collection into roughly even pieces, for parallel processing.
|
FloatMap<V> |
union(IMap<Double,V> m) |
FloatMap<V> |
update(double key,
UnaryOperator<V> update) |
FloatMap<V> |
update(Double key,
UnaryOperator<V> update) |
FloatMap<V> |
update(double key,
UnaryOperator<V> update,
Object editor) |
hashCode, toString
finalize, getClass, notify, notifyAll, wait, wait, wait
ceil, ceil, ceilIndex, diffSorted, first, floor, floor, floorIndex, floorIndex, keys, last, slice, slice, sliceIndices
apply, contains, containsAll, containsAll, containsAny, containsAny, diff, get, getOrCreate, hashSortedEntries, iterator, save, spliterator, stream, toMap, values
iterator, nth
public static <V> FloatMap<V> from(Map<Number,V> m)
m
- a Java mappublic static <V> FloatMap<V> from(Collection<Map.Entry<Number,V>> collection)
public Comparator<Double> comparator()
public ToLongFunction<Double> keyHash()
public BiPredicate<Double,Double> keyEquality()
public boolean contains(double key)
public IList<IEntry<Double,V>> entries()
public OptionalLong indexOf(double key)
public OptionalLong indexOf(Double key)
key
within the collection, if it's presentpublic long size()
public OptionalLong floorIndex(double key)
public OptionalLong inclusiveFloorIndex(Double key)
public OptionalLong ceilIndex(double key)
public OptionalLong ceilIndex(Double key)
public FloatMap<V> merge(IMap<Double,V> b, BinaryOperator<V> mergeFn)
b
- another mapmergeFn
- a function which, in the case of key collisions, takes two values and returns the merged resultpublic FloatMap<V> difference(ISet<Double> keys)
keys
public FloatMap<V> intersection(ISet<Double> keys)
keys
public FloatMap<V> union(IMap<Double,V> m)
m
shadowing those in this amppublic FloatMap<V> difference(IMap<Double,?> b)
m
public FloatMap<V> intersection(IMap<Double,?> b)
m
public FloatMap<V> put(double key, V value)
key
- a primitive long
keyvalue
- a valueFloatMap
with value
under key
public FloatMap<V> put(double key, V value, BinaryOperator<V> merge)
key
- a primitive long
keyvalue
- a valuemerge
- a function which will be invoked if there is a pre-existing value under key
, with the current
value as the first argument and new value as the second, to determine the combined resultpublic FloatMap<V> put(Double key, V value, BinaryOperator<V> merge)
merge
- a function which will be invoked if there is a pre-existing value under key
, with the current
value as the first argument and new value as the second, to determine the combined resultvalue
under key
public <U> FloatMap<U> mapValues(BiFunction<Double,V,U> f)
U
- the new type of the valuesf
- a function which transforms the valuespublic V get(Double key, V defaultValue)
key
, or defaultValue
if there is no such keypublic FloatMap<V> update(Double key, UnaryOperator<V> update)
update
- a function which takes the existing value, or null
if none exists, and returns an updated
value.update(value)
under key
.public FloatMap<V> update(double key, UnaryOperator<V> update)
public FloatMap<V> update(double key, UnaryOperator<V> update, Object editor)
public List<FloatMap<V>> split(int parts)
ICollection
parts
subsets.parts
- the target number of piecespublic boolean isLinear()
public FloatMap<V> forked()
ICollection
If only a single function or scope uses the data structure, it can be left as a linear data structure, which can have significant performance benefits.
If the data structure is already forked, it will simply return itself.
public FloatMap<V> linear()
ICollection
If ICollection.forked()
is called on a linear collection, all references to that linear collection
should be discarded.
If the data structure is already linear, it will simply return itself.
public boolean equals(IMap<Double,V> o, BiPredicate<V,V> valEquals)
o
- another mapvalEquals
- a predicate which checks value equalitiespublic boolean equals(Object obj)
equals
in class IMap.Mixin<Double,V>