java.util APIs
Composite Recipes
Recipes that include further recipes, often including the individual recipes below.
- Adopt
SequencedCollection - Replace
InflaterandDeflaterend()calls withclose() - Use modernized
java.utilAPIs
Recipes
- Prefer
EnumSet of(..) - Prefer
List.of(..) - Prefer
List.of(..) - Prefer
Locale.of(..)overnew Locale(..) - Prefer
Map.of(..) - Prefer
Map.of(..) - Prefer
Optional.isEmpty() - Prefer
Optional.isPresent() - Prefer
Set.of(..) - Prefer
Set.of(..) - Remove invocations of deprecated invocations from Deflater, Inflater, ZipFile
- Replace
List.get(int),add(int, Object), andremove(int)withSequencedCollection*Firstand*Lastmethods - Replace
Stream.collect(Collectors.toUnmodifiableList())withStream.toList() - Replace
iterator().next()withgetFirst() - Replace
java.lang.Math random()withThreadLocalRandom nextDouble() Stream<Optional>idiom recipe- Use
Reader.of(CharSequence)for non-synchronized readers - Use
getFirst()instead ofstream().findFirst().orElseThrow()