我已经习惯了 C#,IEnumerable<T>.SelectMany但发现自己使用 Google 的 Guava 库涉足了一些 Java 代码。番石榴中是否有等同于 SelectMany 的东西?
示例:如果我有这样的流/映射结构
collections .stream() .map(collection -> loadKeys(collection.getTenant(), collection.getGroup())) .collect(GuavaCollectors.immutableSet());
whereloadKeys返回类似的东西ImmutableSet<String>,这个函数会返回ImmutableSet<ImmutableSet<String>>,但我想把它们压平成一个ImmutableSet<String>
最好的方法是什么?
GCT1015
跃然一笑
随时随地看视频慕课网APP
相关分类