Versions: SonarQube Version 6.7.1 (build 35068), SonarJava: 5.4 (build 14284)
In this situation, Sonar suggests to replace the lambda by a method reference. It is however not possible since there are two methods matching: Integer.toString()
and Integer.toString(int)
.
Set<Integer> tempSet = new HashSet<>();
tempSet.stream().filter(Objects::nonNull).map(i -> i.toString());
Sonar should not make this impossible suggestion.
Workaround would be to use the String::valueOf
method reference.