I want clean Sonar issue after create new code in java 8.
public class Argument<T> {
...
public T getValue() {
return parameterType.transform(group.getValues());
}
...
}
My code:
List<Argument<?>> args = expression.match(text);
return args == null ? null : args.stream().map(arg -> arg.getValue()).collect(Collectors.toList());
Sonar say:
Lambdas should be replaced with method references. Method/constructor references are more compact and readable than using lambdas, and are therefore preferred. Similarly, null checks can be replaced with references to the Objects::isNull and Objects::nonNull methods.
I want change map(arg -> arg.getValue())
by map(T::getValue())
but is it wrong compilation ().