Class MapFiller.SimpleMapFiller<K,V>

java.lang.Object
ru.progrm_jarvis.javacommons.collection.MapFiller.SimpleMapFiller<K,V>
Type Parameters:
K - type of map's key
V - type of map's value
All Implemented Interfaces:
MapFiller<K,V>
Enclosing interface:
MapFiller<K,V>

public static final class MapFiller.SimpleMapFiller<K,V> extends Object implements MapFiller<K,V>
An utility-object to fill the map following the chain pattern which may useful when initializing class fields.
  • Method Details

    • put

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

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

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

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

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

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

      public String toString()
      Overrides:
      toString in class Object
    • map

      @NonNull public @NonNull Map<K,V> map()
      Description copied from interface: MapFiller
      Gets the filled map.
      Specified by:
      map in interface MapFiller<K,V>
      Returns:
      the filled map