请帮助理解如何在我的示例中使用 fkatMap():
Flux.just("1,2,3", "4,5,6")
.flatMap(// to do something)
.collect(Collectors.toList())
.subscribe(System.out::println);
我阅读了文档。我理解如何工作 flatMap() 但我不明白我需要如何在我的示例中使用。 谢谢。
最佳答案
正如 Kayaman 已经回答的那样,您可以执行以下操作:
Flux.just("1,2,3", "4,5,6")
.flatMap(i -> Flux.fromIterable(Arrays.asList(i.split(","))))
.collect(Collectors.toList())
.subscribe(System.out::println);
关于java - react 器WebFlux : help to understand how to work flatMap(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60352410/