Interface MapFiller<K,V>
- Type Parameters:
K- type of map's keyV- 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 ClassesModifier and TypeInterfaceDescriptionstatic final classAn utility-object to fill the map following the chain pattern which may useful when initializing class fields. -
Method Summary
Modifier and TypeMethodDescriptionFills the map with the values of specifiedIterable.Fills the map based on the specifiedIterator.Fills the map based on the specifiedStream.Fills the map with the values of specified array.fillOrdered(@NonNull Stream<@NotNull ? extends Pair<K, V>> entries) Fills the map based on the specifiedStreamkeeping order.static <K,V> MapFiller<K, V> Creates new map filler from the map specified.static <K,V> MapFiller<K, V> Creates new map filler from the map specified initialized with the value specified.map()Gets the filled map.Puts the specified value by the specified key to the map.
-
Method Details
-
map
Gets the filled map.- Returns:
- the filled map
-
put
Puts the specified value by the specified key to the map.- Parameters:
key- key of the value to putvalue- value to put by the key- Returns:
- this map filler for chaining
-
fill
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 specifiedIterator.- 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 specifiedIterable.- 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 specifiedStream.- 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 specifiedStreamkeeping order.- Parameters:
entries- stream of the entries whose elements will be put to the map- Returns:
- this map filler for chaining
-
from
Creates new map filler from the map specified.- Type Parameters:
K- type of keysV- type of values- Parameters:
map- map for which to create the filler- Returns:
- map filler created for the specified map
- See Also:
-
from
Creates new map filler from the map specified initialized with the value specified.- Type Parameters:
K- type of keysV- type of values- Parameters:
map- map for which to create the fillerfirstKey- the key of the first valuefirstValue- the first value to be put to the map- Returns:
- map filler created for the specified map with initial value put
- See Also:
-