K - Key type.V - Value type.public class KeyValue<K,V> extends Value<V>
Value. A KeyValue requires always a non-null key on construction.| Modifier | Constructor and Description |
|---|---|
protected |
KeyValue()
Serializable constructor.
|
| Modifier and Type | Method and Description |
|---|---|
static <K,V> KeyValue<K,V> |
empty(K key)
Returns an empty
KeyValue instance with the key set. |
boolean |
equals(Object o) |
static <K,T extends V,V> |
from(K key,
Optional<T> optional)
|
static <K,T extends V,V> |
fromNullable(K key,
T value)
|
K |
getKey() |
int |
hashCode() |
static <K,T extends V,V> |
just(K key,
T value)
|
<R> KeyValue<K,R> |
map(Function<? super V,? extends R> mapper)
Returns a
KeyValue consisting of the results of applying the given function to the value of this element. |
String |
toString() |
empty, from, fromNullable, getValue, getValueOrElse, getValueOrElseGet, getValueOrElseThrow, hasValue, ifEmpty, ifHasValue, just, optional, streampublic static <K,T extends V,V> KeyValue<K,V> from(K key, Optional<T> optional)
KeyValue from a key and an Optional. The resulting value contains the value from the
Optional if a value is present. Value is empty if the Optional is empty.K - T - V - key - the key, must not be null.optional - the optional. May be empty but never null.KeyValue.public static <K,T extends V,V> KeyValue<K,V> fromNullable(K key, T value)
KeyValue from a key andvalue. The resulting value contains the value if the
value is not null.K - T - V - key - the key, must not be null.value - the value. May be null.KeyValue.public static <K,V> KeyValue<K,V> empty(K key)
KeyValue instance with the key set. No value is present for this instance.K - V - key - the key, must not be null.KeyValue.public static <K,T extends V,V> KeyValue<K,V> just(K key, T value)
K - T - V - key - the key. Must not be null.value - the value. Must not be null.KeyValue.public K getKey()
Copyright © 2021 lettuce.io. All rights reserved.