Adopt SequencedCollection
MSALReplace older code patterns with SequencedCollection methods, as per https://openjdk.org/jeps/431.
org. openrewrite. java. migrate. util. SequencedCollectionmod run . --recipe= org. openrewrite. java. migrate. util. SequencedCollectionInstall it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.
Recipe list
It runs these recipes, in this order.
- Replace
List.get(int),add(int, Object), andremove(int)withSequencedCollection*Firstand*Lastmethods - Replace
iterator().next()withgetFirst() - Use
getFirst()instead ofstream().findFirst().orElseThrow() - Change method name
java.util.SortedSet first()togetFirst - Change method name
java.util.SortedSet last()togetLast - Change method name
java.util.NavigableSet descendingSet()toreversed