@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(java.lang.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<java.util.Map.Entry<java.lang.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.
|
java.util.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
defaultReturnValue, defaultReturnValue
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
clear, compute, compute, computeIfAbsent, computeIfAbsent, computeIfAbsentPartial, computeIfPresent, computeIfPresent, containsKey, defaultReturnValue, defaultReturnValue, get, getOrDefault, getOrDefault, merge, merge, put, putIfAbsent, putIfAbsent, remove, remove, remove, replace, replace, replace, replace
apply, put, remove
public BasicResultMap(java.lang.Iterable<? extends Result> objs)
Create a new result map from a collection of results.
objs
- The results.public Long2DoubleSortedMap scoreMap()
ResultMap
View this result set as a map from longs to doubles.
scoreMap
in interface ResultMap
scoreMap
in interface LenskitResultMap
public java.util.Iterator<Result> iterator()
iterator
in interface java.lang.Iterable<Result>
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 interface Long2ObjectMap<Result>
containsKey
in class AbstractLong2ObjectMap<Result>
public ObjectCollection<Result> values()
values
in interface Long2ObjectMap<Result>
values
in interface java.util.Map<java.lang.Long,Result>
values
in class AbstractLong2ObjectMap<Result>
public ObjectSet<java.util.Map.Entry<java.lang.Long,Result>> entrySet()
entrySet
in interface Long2ObjectMap<Result>
entrySet
in interface java.util.Map<java.lang.Long,Result>
public LongSet keySet()
keySet
in interface Long2ObjectMap<Result>
keySet
in interface java.util.Map<java.lang.Long,Result>
keySet
in class AbstractLong2ObjectMap<Result>
public int size()
size
in interface Long2ObjectMap<Result>
size
in interface java.util.Map<java.lang.Long,Result>