使用 javaslang 2.1.0-alpha将 aStream<Tuple2<T,U>>
转换为 a的最惯用方法是什么?Map<T,List<U>>
// initial stream
Stream.of(
Tuple.of("foo", "x"),
Tuple.of("foo", "y"),
Tuple.of("bar", "x"),
Tuple.of("bar", "y"),
Tuple.of("bar", "z")
)
应该变成:
// end result
HashMap.ofEntries(
Tuple.of("foo", List.of("x","y")),
Tuple.of("bar", List.of("x","y","z"))
);