Package dev.aura.bungeechat.util
Class MapUtils
- java.lang.Object
-
- dev.aura.bungeechat.util.MapUtils
-
public class MapUtils extends Object
-
-
Constructor Summary
Constructors Constructor Description MapUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T,K,V>
Collector<T,ImmutableMap.Builder<K,V>,ImmutableMap<K,V>>immutableMapCollector(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper)A variant ofCollectors.toMap(Function, Function)for immutable maps.
-
-
-
Method Detail
-
immutableMapCollector
public static <T,K,V> Collector<T,ImmutableMap.Builder<K,V>,ImmutableMap<K,V>> immutableMapCollector(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper) throws IllegalArgumentException
A variant ofCollectors.toMap(Function, Function)for immutable maps.Note this variant throws
IllegalArgumentExceptionupon duplicate keys, rather thanIllegalStateException- Type Parameters:
T- type of the input elementsK- output type of the key mapping functionV- output type of the value mapping function- Parameters:
keyMapper- a mapping function to produce keysvalueMapper- a mapping function to produce values- Returns:
- a
Collectorwhich collects elements into aMapwhose keys and values are the result of applying mapping functions to the input elements - Throws:
IllegalArgumentException- upon duplicate keys
-
-