Interface MapFiller<K,V>

Type Parameters:
K - type of map's key
V - type of map's value
All Known Implementing Classes:
MapFiller.SimpleMapFiller

public interface MapFiller<K,V>
A helper-object to fill the map implementing the chain pattern. This may be useful when initializing class fields.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static final class 
    An utility-object to fill the map following the chain pattern which may useful when initializing class fields.
  • Method Summary

    Modifier and Type
    Method
    Description
    @NotNull MapFiller<K,V>
    fill(@NonNull Iterable<@NotNull ? extends Pair<K,V>> entries)
    Fills the map with the values of specified Iterable.
    @NotNull MapFiller<K,V>
    fill(@NonNull Iterator<@NotNull ? extends Pair<K,V>> entries)
    Fills the map based on the specified Iterator.
    @NotNull MapFiller<K,V>
    fill(@NonNull Stream<@NotNull ? extends Pair<K,V>> entries)
    Fills the map based on the specified Stream.
    @NotNull MapFiller<K,V>
    fill(@NotNull Pair<K,V> @NonNull ... entries)
    Fills the map with the values of specified array.
    @NotNull MapFiller<K,V>
    fillOrdered(@NonNull Stream<@NotNull ? extends Pair<K,V>> entries)
    Fills the map based on the specified Stream keeping order.
    static <K, V> MapFiller<K,V>
    from(@NonNull Map<K,V> map)
    Creates new map filler from the map specified.
    static <K, V> MapFiller<K,V>
    from(@NonNull Map<K,V> map, K firstKey, V firstValue)
    Creates new map filler from the map specified initialized with the value specified.
    @NotNull Map<K,V>
    map()
    Gets the filled map.
    @NotNull MapFiller<K,V>
    put(K key, V value)
    Puts the specified value by the specified key to the map.
  • Method Details

    • map

      @NotNull @NotNull Map<K,V> map()
      Gets the filled map.
      Returns:
      the filled map
    • put

      @NotNull @NotNull MapFiller<K,V> put(K key, V value)
      Puts the specified value by the specified key to the map.
      Parameters:
      key - key of the value to put
      value - value to put by the key
      Returns:
      this map filler for chaining
    • fill

      @NotNull @NotNull MapFiller<K,V> fill(@NotNull @NotNull Pair<K,V> @NonNull ... entries)
      Fills the map with the values of specified array.
      Parameters:
      entries - entries which will be put to the map
      Returns:
      this map filler for chaining
    • fill

      @NotNull @NotNull MapFiller<K,V> fill(@NonNull @NonNull Iterator<@NotNull ? extends Pair<K,V>> entries)
      Fills the map based on the specified Iterator.
      Parameters:
      entries - iterator of the entries whose elements will be put to the map
      Returns:
      this map filler for chaining
    • fill

      @NotNull @NotNull MapFiller<K,V> fill(@NonNull @NonNull Iterable<@NotNull ? extends Pair<K,V>> entries)
      Fills the map with the values of specified Iterable.
      Parameters:
      entries - entries which will be put to the map
      Returns:
      this map filler for chaining
    • fill

      @NotNull @NotNull MapFiller<K,V> fill(@NonNull @NonNull Stream<@NotNull ? extends Pair<K,V>> entries)
      Fills the map based on the specified Stream.
      Parameters:
      entries - stream of the entries whose elements will be put to the map
      Returns:
      this map filler for chaining
    • fillOrdered

      @NotNull @NotNull MapFiller<K,V> fillOrdered(@NonNull @NonNull Stream<@NotNull ? extends Pair<K,V>> entries)
      Fills the map based on the specified Stream keeping order.
      Parameters:
      entries - stream of the entries whose elements will be put to the map
      Returns:
      this map filler for chaining
    • from

      static <K, V> MapFiller<K,V> from(@NonNull @NonNull Map<K,V> map)
      Creates new map filler from the map specified.
      Type Parameters:
      K - type of keys
      V - type of values
      Parameters:
      map - map for which to create the filler
      Returns:
      map filler created for the specified map
      See Also:
    • from

      static <K, V> MapFiller<K,V> from(@NonNull @NonNull Map<K,V> map, K firstKey, V firstValue)
      Creates new map filler from the map specified initialized with the value specified.
      Type Parameters:
      K - type of keys
      V - type of values
      Parameters:
      map - map for which to create the filler
      firstKey - the key of the first value
      firstValue - the first value to be put to the map
      Returns:
      map filler created for the specified map with initial value put
      See Also: