java.lang.Object
io.lettuce.core.Value<V>
io.lettuce.core.ScoredValue<V>
- Type Parameters:
V- Value type.
- All Implemented Interfaces:
Serializable
public class ScoredValue<V> extends Value<V>
A scored-value extension to
Value.- Author:
- Will Glozer, Mark Paluch
- See Also:
- Serialized Form
-
Constructor Summary
Constructors Modifier Constructor Description protectedScoredValue()Serializable constructor. -
Method Summary
Modifier and Type Method Description static <V> ScoredValue<V>empty()Returns an emptyScoredValueinstance.booleanequals(Object o)static <T extends V, V>
Value<V>from(double score, Optional<T> optional)static <T extends V, V>
Value<V>fromNullable(double score, T value)doublegetScore()inthashCode()static <T extends V, V>
ScoredValue<V>just(double score, T value)<R> ScoredValue<R>map(Function<? super V,? extends R> mapper)Returns aScoredValueconsisting of the results of applying the given function to the value of this element.ScoredValue<V>mapScore(Function<? super Number,? extends Number> mapper)Returns aScoredValueconsisting of the results of applying the given function to the score of this element.StringtoString()Methods inherited from class io.lettuce.core.Value
from, fromNullable, getValue, getValueOrElse, getValueOrElseGet, getValueOrElseThrow, hasValue, ifEmpty, ifHasValue, ifHasValueOrElse, isEmpty, just, optional, stream
-
Constructor Details
-
ScoredValue
protected ScoredValue()Serializable constructor.
-
-
Method Details
-
from
Creates aValuefrom akeyand anOptional. The resulting value contains the value from theOptionalif a value is present. Value is empty if theOptionalis empty.- Parameters:
score- the score.optional- the optional. May be empty but nevernull.- Returns:
- the
Value.
-
fromNullable
Creates aValuefrom ascoreandvalue. The resulting value contains the value if thevalueis not null.- Parameters:
score- the score.value- the value. May benull.- Returns:
- the
Value.
-
empty
Returns an emptyScoredValueinstance. No value is present for this instance.- Returns:
- the
ScoredValue
-
just
- Parameters:
score- the score.value- the value. Must not benull.- Returns:
- the
ScoredValue.
-
getScore
public double getScore() -
equals
-
hashCode
public int hashCode() -
toString
-
map
Returns aScoredValueconsisting of the results of applying the given function to the value of this element. Mapping is performed only if avalue is present.- Overrides:
mapin classValue<V>- Type Parameters:
R- element type of the newScoredValue.- Parameters:
mapper- a stateless function to apply to each element.- Returns:
- the new
ScoredValue.
-
mapScore
Returns aScoredValueconsisting of the results of applying the given function to the score of this element. Mapping is performed only if avalue is present.- Parameters:
mapper- a stateless function to apply to each element.- Returns:
- the new
ScoredValue.
-