Class MultiValuedKeyMap<T>

java.lang.Object
de.scravy.bedrock.MultiValuedKeyMap<T>
All Implemented Interfaces:
Function1<Seq<Object>,​T>, Function<Seq<Object>,​T>

public class MultiValuedKeyMap<T>
extends Object
implements Function1<Seq<Object>,​T>
  • Constructor Details

  • Method Details

    • get

      public <K> Optional<T> get​(Seq<K> key)
    • get

      public <K> T get​(Seq<K> key, T fallback)
    • get

      public <K> T get​(Seq<K> key, Supplier<T> fallbackSupplier)
    • get

      public <K> T get​(Seq<K> key, @Nullable T fallback, List<Object> trace)
      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

      public <K> T get​(Seq<K> key, @Nonnull Supplier<T> fallbackSupplier, List<Object> trace)
      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

      public T apply​(Seq<Object> key)
      Specified by:
      apply in interface Function<Seq<Object>,​T>
      Specified by:
      apply in interface Function1<Seq<Object>,​T>
    • builder

      public static <T> MultiValuedKeyMap.Builder<T> builder()