public final class LongToNumberMap<N extends Comparable<N>> extends Object implements SortedMap<Long,N>, Access1D<N>, Mutate1D.Mixable<N>
SortedMap
with primitive valued long keys and Comparable
values (incl. possibly primitive
double values). The main benefits of using this class is its use of primitive keys and values, and how it
integrates with other parts of ojAlgo. As a general purpose Map
implementation (usage with high
frequency of randomly ordered put and remove operations) it is not very efficient.Modifier and Type | Class and Description |
---|---|
static class |
LongToNumberMap.MapFactory<N extends Comparable<N>> |
Access1D.Aggregatable<N extends Comparable<N>>, Access1D.Collectable<N extends Comparable<N>,R extends Mutate1D.Receiver<N>>, Access1D.Elements, Access1D.ElementView<N extends Comparable<N>>, Access1D.IndexOf, Access1D.Sliceable<N extends Comparable<N>>, Access1D.Visitable<N extends Comparable<N>>
Structure1D.BasicMapper<T>, Structure1D.IndexCallback, Structure1D.IndexMapper<T>, Structure1D.IntIndex, Structure1D.Logical<S extends Structure1D,B extends Structure1D.Logical<S,B>>, Structure1D.LongIndex, Structure1D.LoopCallback
Modifier and Type | Method and Description |
---|---|
long |
capacity()
The current capacity of the underlying data structure.
|
void |
clear() |
Comparator<? super Long> |
comparator() |
boolean |
containsKey(long key) |
boolean |
containsKey(Object key) |
boolean |
containsValue(double value) |
boolean |
containsValue(Object value) |
long |
count() |
double |
doubleValue(long key) |
Set<Map.Entry<Long,N>> |
entrySet() |
static <N extends Comparable<N>> |
factory(DenseArray.Factory<N> denseFactory) |
Long |
firstKey() |
N |
get(long key) |
N |
get(Object key) |
LongToNumberMap<N> |
headMap(long toKey) |
LongToNumberMap<N> |
headMap(Long toKey) |
boolean |
isEmpty() |
Set<Long> |
keySet() |
Long |
lastKey() |
double |
mix(long key,
BinaryFunction<N> mixer,
double addend) |
N |
mix(long key,
BinaryFunction<N> mixer,
N addend) |
SparseArray.NonzeroView<N> |
nonzeros() |
double |
put(long key,
double value) |
N |
put(long key,
N value) |
N |
put(Long key,
N value) |
void |
putAll(LongToNumberMap<N> m) |
void |
putAll(Map<? extends Long,? extends N> m) |
N |
remove(long key) |
N |
remove(Object key) |
int |
size() |
LongToNumberMap<N> |
subMap(long fromKey,
long toKey) |
LongToNumberMap<N> |
subMap(Long fromKey,
Long toKey) |
LongToNumberMap<N> |
tailMap(long fromKey) |
LongToNumberMap<N> |
tailMap(Long fromKey) |
String |
toString() |
NumberList<N> |
values() |
Access1D<N> |
values(long fromKey,
long toKey)
Should return the same elements/values as first calling
subMap(Long, Long) and then
values() but this method does not create any copies. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
asCollectable1D, asPrimitive1D, axpy, byteValue, dot, elements, equals, floatValue, hashCode, intValue, longValue, shortValue, supplyTo, toRawCopy1D, toString, wrap, wrap, wrap
index, loopAll, loopMatching, loopRange, mapper, toIntIndexes
public static <N extends Comparable<N>> LongToNumberMap.MapFactory<N> factory(DenseArray.Factory<N> denseFactory)
public long capacity()
public Comparator<? super Long> comparator()
comparator
in interface SortedMap<Long,N extends Comparable<N>>
public boolean containsKey(long key)
public boolean containsKey(Object key)
containsKey
in interface Map<Long,N extends Comparable<N>>
public boolean containsValue(double value)
public boolean containsValue(Object value)
containsValue
in interface Map<Long,N extends Comparable<N>>
public long count()
count
in interface Structure1D
public double doubleValue(long key)
doubleValue
in interface Access1D<N extends Comparable<N>>
public Long firstKey()
public LongToNumberMap<N> headMap(long toKey)
public LongToNumberMap<N> headMap(Long toKey)
public boolean isEmpty()
public Long lastKey()
public double mix(long key, BinaryFunction<N> mixer, double addend)
mix
in interface Mutate1D.Mixable<N extends Comparable<N>>
public N mix(long key, BinaryFunction<N> mixer, N addend)
mix
in interface Mutate1D.Mixable<N extends Comparable<N>>
public SparseArray.NonzeroView<N> nonzeros()
nonzeros
in interface Access1D<N extends Comparable<N>>
public double put(long key, double value)
public void putAll(LongToNumberMap<N> m)
public N remove(long key)
public int size()
size
in interface Map<Long,N extends Comparable<N>>
size
in interface Structure1D
public LongToNumberMap<N> subMap(long fromKey, long toKey)
public LongToNumberMap<N> subMap(Long fromKey, Long toKey)
public LongToNumberMap<N> tailMap(long fromKey)
public LongToNumberMap<N> tailMap(Long fromKey)
public NumberList<N> values()
public Access1D<N> values(long fromKey, long toKey)
subMap(Long, Long)
and then
values()
but this method does not create any copies. Any change in the underlying data
structure (this map) will corrupt this method's output.Copyright © 2019 Optimatika. All rights reserved.