public static <S,K,M extends Map<K,S>>Collector<S,?,M> toDictionary(Function<? super S,? extends K> keyMapper,Supplier<M> mapSupplier){
  return Collectors.toMap(keyMapper,Function.identity(),StreamUtils.throwingMerger(),mapSupplier);
}

public static < S , K , M extends Map < K , S > > Collector < S , ? , M > toDictionary ( Function < ? super S , ? extends K > keyMapper , Supplier < M > mapSupplier ) { return Collectors . toMap ( keyMapper , Function . identity ( ) , StreamUtils . throwingMerger ( ) , mapSupplier ) ; }
return a collector that creates a dictionary using the given key function and the given map supplier . this collector assumes the elements being collected are distinct .
