Find Flux.flatMap { x -> Mono.just(f(x)) } patterns

Proprietary

A Flux.flatMap whose lambda only wraps a value back into Mono.just (or Flux.just) is doing the work of map. Drop the publisher boxing and the runtime cost of subscribing to a one-shot inner publisher per element.

org.openrewrite.kotlin.spring.FindFluxFlatMapReturningFluxJust$KtRecipe
mod run . --recipe='org.openrewrite.kotlin.spring.FindFluxFlatMapReturningFluxJust$KtRecipe'

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.