E - the type of keys for this mappublic class ObjectToDoubleMap<E> extends HashMap<E,Double>
ObjectToDoubleMap maintains a mapping from
objects to double-valued counters, which may be incremented or set.
Objects not in the underlying map's key set are assumed to have
value 0.0. Thus incrementing an object that is not currently
set is equivalent to setting it to the increment value.AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>| Constructor and Description |
|---|
ObjectToDoubleMap()
Construct an object to double mapping.
|
ObjectToDoubleMap(int initialCapacity)
Construct an object to double mapping with the specified
initial capacity.
|
| Modifier and Type | Method and Description |
|---|---|
double |
getValue(E key)
Returns the value of the specified key in the map.
|
void |
increment(E key,
double increment)
Increment the value of the specified key by the specified
increment amount.
|
List<E> |
keysOrderedByValueList()
Returns the list of keys ordered in decreasing order of
value.
|
List<ScoredObject<E>> |
scoredObjectsOrderedByValueList()
Returns a list of scored objects corresponding to the entries
in decreasing order of value.
|
void |
set(E key,
double val)
Sets the specified key to the specified value.
|
void |
setAndKeepZeros(E key,
double val)
Sets the specified key to the specified value
allowing 0.0
|
Comparator<E> |
valueComparator()
Returns the comparator that compares objects based on their
values.
|
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, valuesequals, hashCode, toStringpublic ObjectToDoubleMap()
public ObjectToDoubleMap(int initialCapacity)
initialCapacity - Initial capacity of the map.public void increment(E key, double increment)
key - Object to increment.increment - Increment amount.public void set(E key, double val)
key - Object to set.val - New value for the object.public void setAndKeepZeros(E key, double val)
key - Object to set.val - New value for the object.public double getValue(E key)
key - Object whose value is returned.public List<E> keysOrderedByValueList()
public List<ScoredObject<E>> scoredObjectsOrderedByValueList()
public Comparator<E> valueComparator()
Copyright © 2016 Alias-i, Inc.. All rights reserved.