Replace filter then size with count

Proprietary

Replaces .filter(f).size or .filter(f).length chains with .count(f) to avoid creating an unnecessary intermediate collection.

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

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