/** * Provides a {@link Collector} which can be used to collect a {@link Stream} of tuples into a {@link Map}. * <p> * Key collisions are automatically handled by choosing the later entry (updating the map). * * @param supplier factory for generating the result map * @param <K> key type of the tuples being processed * @param <V> value type of the tuples being processed * @return a <tt>Collector</tt> which transforms a stream of tuples into a map */ public static <K, V> Collector<Tuple<K, V>, Map<K, V>, Map<K, V>> toMap(Supplier<Map<K, V>> supplier) { return toMap(supplier, (a, b) -> b); }