Replace .head with .headOption
ProprietaryReplaces .head calls on collections with .headOption to avoid NoSuchElementException on empty collections.
org. openrewrite. scala. performance. UseHeadOptionmod run . --recipe= org. openrewrite. scala. performance. UseHeadOptionInstall it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.