@Immutable public final class Long2DoubleSortedArrayMap extends AbstractLong2DoubleSortedMap
An immutable long-to-double map backed by a sorted key array.
AbstractLong2DoubleSortedMap.KeySet, AbstractLong2DoubleSortedMap.KeySetIterator, AbstractLong2DoubleSortedMap.ValuesCollection, AbstractLong2DoubleSortedMap.ValuesIterator
AbstractLong2DoubleMap.BasicEntry
Long2DoubleSortedMap.FastSortedEntrySet
Long2DoubleMap.Entry, Long2DoubleMap.FastEntrySet
defRetValue
Constructor and Description |
---|
Long2DoubleSortedArrayMap(java.util.Map<java.lang.Long,java.lang.Double> data)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
LongComparator |
comparator() |
boolean |
containsKey(long k) |
static Long2DoubleSortedArrayMap |
create(Long2DoubleMap input)
Create a new long-to-double sorted array map from another map.
|
static Long2DoubleSortedArrayMap |
create(java.util.Map<java.lang.Long,java.lang.Double> data)
Create a new sorted array map from input data.
|
long |
firstLongKey() |
static Long2DoubleSortedArrayMap |
fromArray(KeyIndex mapping,
double[] values)
Create a map from an array and index mapping.
|
static Long2DoubleSortedArrayMap |
fromArray(KeyIndex mapping,
DoubleList values)
Create a map from an array and index mapping.
|
double |
get(long l) |
long |
getKeyByIndex(int i)
Get a key by its position in the map.
|
double |
getValueByIndex(int i)
Get a value by its position in the map.
|
Long2DoubleSortedMap |
headMap(long l) |
LongSortedArraySet |
keySet() |
long |
lastLongKey() |
Long2DoubleSortedMap.FastSortedEntrySet |
long2DoubleEntrySet() |
int |
size() |
Long2DoubleSortedArrayMap |
subMap(long from,
long to) |
Long2DoubleSortedArrayMap |
subMap(LongSet toKeep)
Return a subset of this map containing only the keys that appear in another set.
|
Long2DoubleSortedMap |
tailMap(long l) |
static Long2DoubleSortedArrayMap |
wrap(SortedKeyIndex keys,
double[] vs)
Create a new long-to-double map backed by a key index and a corresponding value array.
|
static Long2DoubleSortedArrayMap |
wrapUnsorted(long[] keys,
double[] values)
Create a new
Long2DoubleSortedArrayMap from unsorted key and value arrays. |
values
containsValue, equals, hashCode, isEmpty, putAll, toString
defaultReturnValue, defaultReturnValue
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
entrySet, firstKey, headMap, lastKey, subMap, tailMap
clear, compute, compute, computeIfAbsent, computeIfAbsent, computeIfAbsentNullable, computeIfAbsentPartial, computeIfPresent, computeIfPresent, containsKey, containsValue, containsValue, defaultReturnValue, defaultReturnValue, get, getOrDefault, getOrDefault, merge, merge, put, putIfAbsent, putIfAbsent, remove, remove, remove, replace, replace, replace, replace
applyAsDouble, put, remove
@Deprecated public Long2DoubleSortedArrayMap(java.util.Map<java.lang.Long,java.lang.Double> data)
Create a new map with existing data.
data
- Use create(Map)
instead, as it can avoid copying maps that are already packed.public static Long2DoubleSortedArrayMap create(Long2DoubleMap input)
Create a new long-to-double sorted array map from another map.
Using this method instead of the constructor allows copies of immutable vectors to be skipped.
input
- The vector to copy.input
.public static Long2DoubleSortedArrayMap wrap(SortedKeyIndex keys, double[] vs)
Create a new long-to-double map backed by a key index and a corresponding value array.
keys
- The keys.vs
- The values (the array is used as-is, it is not copied).public static Long2DoubleSortedArrayMap wrapUnsorted(long[] keys, double[] values)
Create a new Long2DoubleSortedArrayMap
from unsorted key and value arrays. The provided arrays will be modified and should not be used by the client after this operation has completed. The key domain of the new Long2DoubleSortedArrayMap
will be the same as keys
.
keys
- Array of entry keys. This should be duplicate-free.values
- The values of the vector, in key order.java.lang.IllegalArgumentException
- if there is a problem with the provided arrays (length mismatch, etc.).public static Long2DoubleSortedArrayMap fromArray(KeyIndex mapping, double[] values)
Create a map from an array and index mapping.
mapping
- The index mapping specifying the keys.values
- The array of values.map
to the values in values
.java.lang.IllegalArgumentException
- if values
not the same size as idx
.public static Long2DoubleSortedArrayMap fromArray(KeyIndex mapping, DoubleList values)
Create a map from an array and index mapping.
mapping
- The index mapping specifying the keys.values
- The array of values.map
to the values in values
.java.lang.IllegalArgumentException
- if values
not the same size as idx
.public static Long2DoubleSortedArrayMap create(java.util.Map<java.lang.Long,java.lang.Double> data)
Create a new sorted array map from input data.
data
- The input data.public Long2DoubleSortedMap.FastSortedEntrySet long2DoubleEntrySet()
public LongSortedArraySet keySet()
keySet
in interface Long2DoubleMap
keySet
in interface Long2DoubleSortedMap
keySet
in interface java.util.Map<java.lang.Long,java.lang.Double>
keySet
in interface java.util.SortedMap<java.lang.Long,java.lang.Double>
keySet
in class AbstractLong2DoubleSortedMap
public long getKeyByIndex(int i)
Get a key by its position in the map. Used for optimizing certain operations.
i
- The index.i
.public double getValueByIndex(int i)
Get a value by its position in the map. Used for optimizing certain operations.
i
- The index.i
.public LongComparator comparator()
public Long2DoubleSortedArrayMap subMap(long from, long to)
public Long2DoubleSortedArrayMap subMap(LongSet toKeep)
Return a subset of this map containing only the keys that appear in another set.
toKeep
- The set of keys to keep.keys
.public Long2DoubleSortedMap headMap(long l)
public Long2DoubleSortedMap tailMap(long l)
public long firstLongKey()
public long lastLongKey()
public double get(long l)
public boolean containsKey(long k)
containsKey
in interface Long2DoubleFunction
containsKey
in interface Long2DoubleMap
containsKey
in class AbstractLong2DoubleMap
public int size()