Replace map then flatten with flatMap

Proprietary

Replaces .map(f).flatten chains with .flatMap(f) for clarity and to avoid creating an unnecessary intermediate collection.

org.openrewrite.scala.performance.UseFlatMap
mod run . --recipe=org.openrewrite.scala.performance.UseFlatMap

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