Reputation: 2971
This is an example, the original code (if i remember) is
public static List<String> transform(List<String> listOfString) {
return listOfString.stream()
.map(str -> toUpperCase(str))
.collect(toList());
}
If you look at the line of map, it can be improved
public static List<String> transform(List<String> listOfString) {
return listOfString.stream()
.map(String::toCamelCase)
.collect(toList());
}
My question is, any plugin can reminder me about this ?
Upvotes: 1
Views: 55
Reputation: 1394
You may use "Replace lambda with method reference" quick-fix (available at Alt+Enter)
provided by "Lambda can be replaced with method reference" inspection (Java | Java language level migration aids | Java 8 | Lambda can be replaced with method reference).
Upvotes: 2