gpt4 book ai didi

java - react 器WebFlux : help to understand how to work flatMap()

转载 作者:行者123 更新时间:2023-12-02 08:58:21 24 4
gpt4 key购买 nike

请帮助理解如何在我的示例中使用 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com