user3552178
user3552178

Reputation: 2971

What intellji plugin can help to improve java coding?

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

Answers (2)

Olga Klisho
Olga Klisho

Reputation: 1394

You may use "Replace lambda with method reference" quick-fix (available at Alt+Enter) enter image description here

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

desoss
desoss

Reputation: 622

Sure i suggest you sonarlint!

Take a look at it:

SonarLint

Upvotes: 1

Related Questions