Package de.scravy.bedrock
Class MultiValuedKeyMap<T>
java.lang.Object
de.scravy.bedrock.MultiValuedKeyMap<T>
public class MultiValuedKeyMap<T> extends Object implements Function1<Seq<Object>,T>
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMultiValuedKeyMap.Builder<T> -
Constructor Summary
Constructors Constructor Description MultiValuedKeyMap() -
Method Summary
Modifier and Type Method Description Tapply(Seq<Object> key)static <T> MultiValuedKeyMap.Builder<T>builder()<K> Optional<T>get(Seq<K> key)<K> Tget(Seq<K> key, Supplier<T> fallbackSupplier)<K> Tget(Seq<K> key, Supplier<T> fallbackSupplier, List<Object> trace)Lookup a value in the map and trace the path taken to find it.<K> Tget(Seq<K> key, T fallback)<K> Tget(Seq<K> key, T fallback, List<Object> trace)Lookup a value in the map and trace the path taken to find it.
-
Constructor Details
-
MultiValuedKeyMap
public MultiValuedKeyMap()
-
-
Method Details
-
get
-
get
-
get
-
get
Lookup a value in the map and trace the path taken to find it.- Type Parameters:
K- The type of values in the key.- Parameters:
key- The key to look for.fallback- The fallback value to use in case there is no value for the given key.trace- A mutable list to trace the path taken into.- Returns:
- The found value or the fallback value.
-
get
Lookup a value in the map and trace the path taken to find it.- Type Parameters:
K- The type of values in the key.- Parameters:
key- The key to look for.fallbackSupplier- A supplier to generate a fallback value in case there is no value for the given key.trace- A mutable list to trace the path taken into.- Returns:
- The found value or the fallback value.
-
apply
-
builder
-