Class LinkedHashMultimap.Builder<V>
java.lang.Object
io.vavr.collection.LinkedHashMultimap.Builder<V>
- Enclosing class:
LinkedHashMultimap<K,V>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Multimap.ContainerTypeprivate final AbstractMultimap.SerializableSupplier<Traversable<?>> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateBuilder(Multimap.ContainerType containerType, AbstractMultimap.SerializableSupplier<Traversable<?>> emptyContainer) -
Method Summary
Modifier and TypeMethodDescriptionReturns aCollectorwhich may be used in conjunction withStream.collect(Collector)to obtain aLinkedHashMultimap.<K, V2 extends V>
LinkedHashMultimap<K, V2> empty()Returns the emptyLinkedHashMultimap.<K, V2 extends V>
LinkedHashMultimap<K, V2> Returns a LinkedHashMultimap containingntimes the givenelement<K, V2 extends V>
LinkedHashMultimap<K, V2> Returns a LinkedHashMultimap containingnvalues supplied by a given Suppliers.<K, V2 extends V>
LinkedHashMultimap<K, V2> Creates a LinkedHashMultimap of the given key-value pair.<K, V2 extends V>
LinkedHashMultimap<K, V2> of(K key, V2 value) Creates a LinkedHashMultimap of the given key-value pair.<K, V2 extends V>
LinkedHashMultimap<K, V2> of(K k1, V2 v1, K k2, V2 v2) Creates a LinkedHashMultimap of the given list of key-value pairs.<K, V2 extends V>
LinkedHashMultimap<K, V2> of(K k1, V2 v1, K k2, V2 v2, K k3, V2 v3) Creates a LinkedHashMultimap of the given list of key-value pairs.<K, V2 extends V>
LinkedHashMultimap<K, V2> of(K k1, V2 v1, K k2, V2 v2, K k3, V2 v3, K k4, V2 v4) Creates a LinkedHashMultimap of the given list of key-value pairs.<K, V2 extends V>
LinkedHashMultimap<K, V2> of(K k1, V2 v1, K k2, V2 v2, K k3, V2 v3, K k4, V2 v4, K k5, V2 v5) Creates a LinkedHashMultimap of the given list of key-value pairs.<K, V2 extends V>
LinkedHashMultimap<K, V2> of(K k1, V2 v1, K k2, V2 v2, K k3, V2 v3, K k4, V2 v4, K k5, V2 v5, K k6, V2 v6) Creates a LinkedHashMultimap of the given list of key-value pairs.<K, V2 extends V>
LinkedHashMultimap<K, V2> of(K k1, V2 v1, K k2, V2 v2, K k3, V2 v3, K k4, V2 v4, K k5, V2 v5, K k6, V2 v6, K k7, V2 v7) Creates a LinkedHashMultimap of the given list of key-value pairs.<K, V2 extends V>
LinkedHashMultimap<K, V2> of(K k1, V2 v1, K k2, V2 v2, K k3, V2 v3, K k4, V2 v4, K k5, V2 v5, K k6, V2 v6, K k7, V2 v7, K k8, V2 v8) Creates a LinkedHashMultimap of the given list of key-value pairs.<K, V2 extends V>
LinkedHashMultimap<K, V2> of(K k1, V2 v1, K k2, V2 v2, K k3, V2 v3, K k4, V2 v4, K k5, V2 v5, K k6, V2 v6, K k7, V2 v7, K k8, V2 v8, K k9, V2 v9) Creates a LinkedHashMultimap of the given list of key-value pairs.<K, V2 extends V>
LinkedHashMultimap<K, V2> of(K k1, V2 v1, K k2, V2 v2, K k3, V2 v3, K k4, V2 v4, K k5, V2 v5, K k6, V2 v6, K k7, V2 v7, K k8, V2 v8, K k9, V2 v9, K k10, V2 v10) Creates a LinkedHashMultimap of the given list of key-value pairs.<K, V2 extends V>
LinkedHashMultimap<K, V2> Returns aLinkedHashMultimap, from a source java.util.Map.<T, K, V2 extends V>
LinkedHashMultimap<K, V2> ofAll(Stream<? extends T> stream, Function<? super T, ? extends K> keyMapper, Function<? super T, ? extends V2> valueMapper) Returns aLinkedHashMultimap, from entries mapped from stream.<T, K, V2 extends V>
LinkedHashMultimap<K, V2> ofAll(Stream<? extends T> stream, Function<? super T, Tuple2<? extends K, ? extends V2>> entryMapper) Returns aLinkedHashMultimap, from entries mapped from stream.final <K, V2 extends V>
LinkedHashMultimap<K, V2> Creates aLinkedHashMultimapof the given entries.<K, V2 extends V>
LinkedHashMultimap<K, V2> Creates aLinkedHashMultimapof the given entries.final <K, V2 extends V>
LinkedHashMultimap<K, V2> Creates aLinkedHashMultimapof the given entries.<K, V2 extends V>
LinkedHashMultimap<K, V2> Returns a LinkedHashMultimap containingnvalues of a given Functionfover a range of integer values from 0 ton - 1.
-
Field Details
-
containerType
-
emptyContainer
-
-
Constructor Details
-
Builder
private Builder(Multimap.ContainerType containerType, AbstractMultimap.SerializableSupplier<Traversable<?>> emptyContainer)
-
-
Method Details
-
empty
Returns the emptyLinkedHashMultimap.- Type Parameters:
K- The key typeV2- The value type- Returns:
- A new empty LinkedHashMultimap.
-
ofEntries
public <K, V2 extends V> LinkedHashMultimap<K,V2> ofEntries(Iterable<? extends Tuple2<? extends K, ? extends V2>> entries) Creates aLinkedHashMultimapof the given entries.- Type Parameters:
K- The key typeV2- The value type- Parameters:
entries- Multimap entries- Returns:
- A new LinkedHashMultimap containing the given entries.
-
ofEntries
@SafeVarargs public final <K, V2 extends V> LinkedHashMultimap<K,V2> ofEntries(Tuple2<? extends K, ? extends V2>... entries) Creates aLinkedHashMultimapof the given entries.- Type Parameters:
K- The key typeV2- The value type- Parameters:
entries- Multimap entries- Returns:
- A new LinkedHashMultimap containing the given entries.
-
ofEntries
@SafeVarargs public final <K, V2 extends V> LinkedHashMultimap<K,V2> ofEntries(Map.Entry<? extends K, ? extends V2>... entries) Creates aLinkedHashMultimapof the given entries.- Type Parameters:
K- The key typeV2- The value type- Parameters:
entries- Multimap entries- Returns:
- A new LinkedHashMultimap containing the given entries.
-
ofAll
Returns aLinkedHashMultimap, from a source java.util.Map.- Type Parameters:
K- The key typeV2- The value type- Parameters:
map- A map- Returns:
- A new Multimap containing the given map entries
-
ofAll
public <T, K, V2 extends V> LinkedHashMultimap<K,V2> ofAll(Stream<? extends T> stream, Function<? super T, ? extends K> keyMapper, Function<? super T, ? extends V2> valueMapper) Returns aLinkedHashMultimap, from entries mapped from stream.- Type Parameters:
T- The stream element typeK- The key typeV2- The value type- Parameters:
stream- the source streamkeyMapper- the key mappervalueMapper- the value mapper- Returns:
- A new Multimap
-
ofAll
public <T, K, V2 extends V> LinkedHashMultimap<K,V2> ofAll(Stream<? extends T> stream, Function<? super T, Tuple2<? extends K, ? extends V2>> entryMapper) Returns aLinkedHashMultimap, from entries mapped from stream.- Type Parameters:
T- The stream element typeK- The key typeV2- The value type- Parameters:
stream- the source streamentryMapper- the entry mapper- Returns:
- A new Multimap
-
tabulate
public <K, V2 extends V> LinkedHashMultimap<K,V2> tabulate(int n, Function<? super Integer, ? extends Tuple2<? extends K, ? extends V2>> f) Returns a LinkedHashMultimap containingnvalues of a given Functionfover a range of integer values from 0 ton - 1.- Type Parameters:
K- The key typeV2- The value type- Parameters:
n- The number of elements in the LinkedHashMultimapf- The Function computing element values- Returns:
- A LinkedHashMultimap consisting of elements
f(0),f(1), ..., f(n - 1) - Throws:
NullPointerException- iffis null
-
fill
public <K, V2 extends V> LinkedHashMultimap<K,V2> fill(int n, Supplier<? extends Tuple2<? extends K, ? extends V2>> s) Returns a LinkedHashMultimap containingnvalues supplied by a given Suppliers.- Type Parameters:
K- The key typeV2- The value type- Parameters:
n- The number of elements in the LinkedHashMultimaps- The Supplier computing element values- Returns:
- A LinkedHashMultimap of size
n, where each element contains the result supplied bys. - Throws:
NullPointerException- ifsis null
-
fill
public <K, V2 extends V> LinkedHashMultimap<K,V2> fill(int n, Tuple2<? extends K, ? extends V2> element) Returns a LinkedHashMultimap containingntimes the givenelement- Type Parameters:
K- The key typeV2- The value type- Parameters:
n- The number of elements in the LinkedHashMultimapelement- The element- Returns:
- A LinkedHashMultimap of size
1, where each element containsnvalues ofelement._2.
-
of
Creates a LinkedHashMultimap of the given key-value pair.- Type Parameters:
K- The key typeV2- The value type- Parameters:
key- A singleton map key.value- A singleton map value.- Returns:
- A new Multimap containing the given entries
-
of
Creates a LinkedHashMultimap of the given list of key-value pairs.- Type Parameters:
K- The key typeV2- The value type- Parameters:
k1- a key for the mapv1- the value for k1k2- a key for the mapv2- the value for k2- Returns:
- A new Multimap containing the given entries
-
of
Creates a LinkedHashMultimap of the given list of key-value pairs.- Type Parameters:
K- The key typeV2- The value type- Parameters:
k1- a key for the mapv1- the value for k1k2- a key for the mapv2- the value for k2k3- a key for the mapv3- the value for k3- Returns:
- A new Multimap containing the given entries
-
of
public <K, V2 extends V> LinkedHashMultimap<K,V2> of(K k1, V2 v1, K k2, V2 v2, K k3, V2 v3, K k4, V2 v4) Creates a LinkedHashMultimap of the given list of key-value pairs.- Type Parameters:
K- The key typeV2- The value type- Parameters:
k1- a key for the mapv1- the value for k1k2- a key for the mapv2- the value for k2k3- a key for the mapv3- the value for k3k4- a key for the mapv4- the value for k4- Returns:
- A new Multimap containing the given entries
-
of
public <K, V2 extends V> LinkedHashMultimap<K,V2> of(K k1, V2 v1, K k2, V2 v2, K k3, V2 v3, K k4, V2 v4, K k5, V2 v5) Creates a LinkedHashMultimap of the given list of key-value pairs.- Type Parameters:
K- The key typeV2- The value type- Parameters:
k1- a key for the mapv1- the value for k1k2- a key for the mapv2- the value for k2k3- a key for the mapv3- the value for k3k4- a key for the mapv4- the value for k4k5- a key for the mapv5- the value for k5- Returns:
- A new Multimap containing the given entries
-
of
public <K, V2 extends V> LinkedHashMultimap<K,V2> of(K k1, V2 v1, K k2, V2 v2, K k3, V2 v3, K k4, V2 v4, K k5, V2 v5, K k6, V2 v6) Creates a LinkedHashMultimap of the given list of key-value pairs.- Type Parameters:
K- The key typeV2- The value type- Parameters:
k1- a key for the mapv1- the value for k1k2- a key for the mapv2- the value for k2k3- a key for the mapv3- the value for k3k4- a key for the mapv4- the value for k4k5- a key for the mapv5- the value for k5k6- a key for the mapv6- the value for k6- Returns:
- A new Multimap containing the given entries
-
of
public <K, V2 extends V> LinkedHashMultimap<K,V2> of(K k1, V2 v1, K k2, V2 v2, K k3, V2 v3, K k4, V2 v4, K k5, V2 v5, K k6, V2 v6, K k7, V2 v7) Creates a LinkedHashMultimap of the given list of key-value pairs.- Type Parameters:
K- The key typeV2- The value type- Parameters:
k1- a key for the mapv1- the value for k1k2- a key for the mapv2- the value for k2k3- a key for the mapv3- the value for k3k4- a key for the mapv4- the value for k4k5- a key for the mapv5- the value for k5k6- a key for the mapv6- the value for k6k7- a key for the mapv7- the value for k7- Returns:
- A new Multimap containing the given entries
-
of
public <K, V2 extends V> LinkedHashMultimap<K,V2> of(K k1, V2 v1, K k2, V2 v2, K k3, V2 v3, K k4, V2 v4, K k5, V2 v5, K k6, V2 v6, K k7, V2 v7, K k8, V2 v8) Creates a LinkedHashMultimap of the given list of key-value pairs.- Type Parameters:
K- The key typeV2- The value type- Parameters:
k1- a key for the mapv1- the value for k1k2- a key for the mapv2- the value for k2k3- a key for the mapv3- the value for k3k4- a key for the mapv4- the value for k4k5- a key for the mapv5- the value for k5k6- a key for the mapv6- the value for k6k7- a key for the mapv7- the value for k7k8- a key for the mapv8- the value for k8- Returns:
- A new Multimap containing the given entries
-
of
public <K, V2 extends V> LinkedHashMultimap<K,V2> of(K k1, V2 v1, K k2, V2 v2, K k3, V2 v3, K k4, V2 v4, K k5, V2 v5, K k6, V2 v6, K k7, V2 v7, K k8, V2 v8, K k9, V2 v9) Creates a LinkedHashMultimap of the given list of key-value pairs.- Type Parameters:
K- The key typeV2- The value type- Parameters:
k1- a key for the mapv1- the value for k1k2- a key for the mapv2- the value for k2k3- a key for the mapv3- the value for k3k4- a key for the mapv4- the value for k4k5- a key for the mapv5- the value for k5k6- a key for the mapv6- the value for k6k7- a key for the mapv7- the value for k7k8- a key for the mapv8- the value for k8k9- a key for the mapv9- the value for k9- Returns:
- A new Multimap containing the given entries
-
of
public <K, V2 extends V> LinkedHashMultimap<K,V2> of(K k1, V2 v1, K k2, V2 v2, K k3, V2 v3, K k4, V2 v4, K k5, V2 v5, K k6, V2 v6, K k7, V2 v7, K k8, V2 v8, K k9, V2 v9, K k10, V2 v10) Creates a LinkedHashMultimap of the given list of key-value pairs.- Type Parameters:
K- The key typeV2- The value type- Parameters:
k1- a key for the mapv1- the value for k1k2- a key for the mapv2- the value for k2k3- a key for the mapv3- the value for k3k4- a key for the mapv4- the value for k4k5- a key for the mapv5- the value for k5k6- a key for the mapv6- the value for k6k7- a key for the mapv7- the value for k7k8- a key for the mapv8- the value for k8k9- a key for the mapv9- the value for k9k10- a key for the mapv10- the value for k10- Returns:
- A new Multimap containing the given entries
-
of
Creates a LinkedHashMultimap of the given key-value pair. Returns a singletonLinkedHashMultimap, i.e. aLinkedHashMultimapof one entry.- Type Parameters:
K- The key typeV2- The value type- Parameters:
entry- A tuple containing the key-value pair.- Returns:
- A new LinkedHashMultimap containing the given entry.
-
collector
public <K, V2 extends V> Collector<Tuple2<K,V2>, ArrayList<Tuple2<K, collector()V2>>, Multimap<K, V2>> Returns aCollectorwhich may be used in conjunction withStream.collect(Collector)to obtain aLinkedHashMultimap.- Type Parameters:
K- The key typeV2- The value type- Returns:
- A
LinkedHashMultimapCollector.
-