Adopt SequencedCollection

MSAL

Replace older code patterns with SequencedCollection methods, as per https://openjdk.org/jeps/431.

org.openrewrite.java.migrate.util.SequencedCollection
mod run . --recipe=org.openrewrite.java.migrate.util.SequencedCollection

Install 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.

  1. Replace List.get(int), add(int, Object), and remove(int) with SequencedCollection *First and *Last methods
  2. Replace iterator().next() with getFirst()
  3. Use getFirst() instead of stream().findFirst().orElseThrow()
  4. Change method name java.util.SortedSet first() to getFirst
  5. Change method name java.util.SortedSet last() to getLast
  6. Change method name java.util.NavigableSet descendingSet() to reversed