How can I convert from a Flux with 1 element to a Mono?
Flux.fromArray(arrayOf(1,2,1,1,1,2))
.distinct()
.take(1)
How do I make this a Mono(1)?
Instead of take(1)
, you could use next()
.
This will transform the Flux
into a valued Mono
by taking the first emitted item, or an empty Mono if the Flux is empty itself.