foldLeft(final B init, final BiFunction super B, ? super A, ? extends B> f) {
+ return Collectors.collectingAndThen(Collectors.reducing(Function.identity(), a -> b -> f.apply(b, a), Function::andThen),
+ endo -> endo.apply(init));
+ }
+
+ /**
+ * Collector that merges a stream of maps (with list values) into a single map.
+ *
+ * If the same key appears in multiple maps, the lists are concatenated.
+ *
+ * Example:
+ *
+ *
{@code
+ *
+ * Map> merged = streamOfMaps.collect(StreamUtils.mergeMapsOfLists());
+ * }
+ *
+ * @param
+ * the type of map keys
+ * @param
+ * the type of elements in the value lists
+ * @return a collector producing a merged map with concatenated list values
+ */
+ public static Collector