@Immutable public class BasicResultMap extends AbstractLong2ObjectMap<Result> implements LenskitResultMap
Standard result map implementation.
AbstractLong2ObjectMap.BasicEntry<V>
Long2ObjectMap.Entry<V>, Long2ObjectMap.FastEntrySet<V>
defRetValue
Constructor and Description |
---|
BasicResultMap(Iterable<? extends Result> objs)
Create a new result map from a collection of results.
|
Modifier and Type | Method and Description |
---|---|
boolean |
containsKey(long l) |
ObjectSet<Map.Entry<Long,Result>> |
entrySet() |
Result |
get(long l)
Get a result without boxing the key.
|
double |
getScore(long id)
Get the score associated with an ID.
|
Iterator<Result> |
iterator() |
LongSet |
keySet() |
ObjectSet<Long2ObjectMap.Entry<Result>> |
long2ObjectEntrySet() |
Long2DoubleSortedMap |
scoreMap()
View this result set as a map from longs to doubles.
|
int |
size() |
ObjectCollection<Result> |
values() |
containsValue, equals, hashCode, isEmpty, putAll, toString
clear, containsKey, defaultReturnValue, defaultReturnValue, get, put, put, remove, remove
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
forEach, spliterator
defaultReturnValue, defaultReturnValue, put, remove
clear, containsKey, get, put, remove
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, equals, forEach, get, getOrDefault, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll
public Long2DoubleSortedMap scoreMap()
ResultMap
View this result set as a map from longs to doubles.
scoreMap
in interface ResultMap
scoreMap
in interface LenskitResultMap
public ObjectSet<Long2ObjectMap.Entry<Result>> long2ObjectEntrySet()
long2ObjectEntrySet
in interface Long2ObjectMap<Result>
public Result get(long l)
ResultMap
Get a result without boxing the key.
get
in interface Long2ObjectFunction<Result>
get
in interface ResultMap
l
- The item ID.null
if the key is not in the map.public boolean containsKey(long l)
containsKey
in interface Long2ObjectFunction<Result>
containsKey
in class AbstractLong2ObjectMap<Result>
public ObjectCollection<Result> values()
values
in interface Long2ObjectMap<Result>
values
in interface Map<Long,Result>
values
in class AbstractLong2ObjectMap<Result>
public ObjectSet<Map.Entry<Long,Result>> entrySet()
entrySet
in interface Long2ObjectMap<Result>
entrySet
in interface Map<Long,Result>
entrySet
in class AbstractLong2ObjectMap<Result>
public LongSet keySet()
keySet
in interface Long2ObjectMap<Result>
keySet
in interface Map<Long,Result>
keySet
in class AbstractLong2ObjectMap<Result>
public int size()
public double getScore(long id)
ResultMap
Get the score associated with an ID.
getScore
in interface ResultMap
id
- The ID to query.id
, or Double.NaN
if there is no score.