Using a method reference to refer to the abstract method of the target type is unnecessary. For example,
Stream<Integer> filter(Stream<Integer> xs, Predicate<Integer> predicate) {
return xs.filter(predicate::test);
}
Stream<Integer> filter(Stream<Integer> xs, Predicate<Integer> predicate) {
return xs.filter(predicate);
}
Suppress false positives by adding the suppression annotation @SuppressWarnings("UnnecessaryMethodReference")
to the enclosing element.