Back to Intellij Community

Java8ListReplaceAll

java/java-impl/resources/inspectionDescriptions/Java8ListReplaceAll.html

2025.3-rc-2316 B
Original Source

Reports loops which can be collapsed into a single List.replaceAll() call.

Example:

for (int i = 0; i < strings.size(); i++) {
    String str = strings.get(i).toLowerCase();
    strings.set(i, str);
  }

After the quick-fix is applied:

strings.replaceAll(String::toLowerCase);

New in 2022.1