assume that lambda on method references place won't require additional cast (IDEA-165335; IDEA-165039)

This commit is contained in:
Anna.Kozlova
2016-12-20 19:31:40 +01:00
parent 1651508c87
commit 38cb2b8c29
8 changed files with 110 additions and 5 deletions
@@ -0,0 +1,28 @@
import java.util.*;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Collector;
import static java.util.function.Predicate.isEqual;
class InlineRef {
Optional<? extends Descriptor> findEmpty() {
Set<? extends Descriptor> children = new HashSet<>();
return children
.stream()
.filter(where(InlineRef::get<caret>Name, isEqual("")))
.findAny();
}
static <T, V> Predicate<T> where(Function<T, V> function, Predicate<? super V> predicate) {
return input -> predicate.test(function.apply(input));
}
static String getName(Descriptor desc) {
return "name";
}
}
class Descriptor { }