I want to convert a Mono of map to flux . can anyone help me on that please?
The object that I have is something like
Mono<Map<Integer , Project>>
where map key is the project key
From this mono I want to construct a flux of project which is something like
flux<project>
as map key is the project id which is present in the project object, we can ignore that.
I try something like this but that did not work I also do not want to use type conversion directly.
Flux<Project> projectFluxReturn = (Flux<Project>) result.toStream().collect(
Collectors.toMap(Project::getProjectId, Function.identity(), (Project project1, Project project2) -> {
project1.getTaskList().addAll(project2.getTaskList());
project2.getTaskList().clear();
return project1;
})
)
.values();