NodeItem.findChild(): rewrite stream filter

This commit is contained in:
Paul Campbell 2016-08-21 12:36:40 +01:00
parent 2da1d9aa3d
commit 1b0b022281

View file

@ -255,10 +255,10 @@ public class NodeItem<T> implements Node<T> {
if (child == null) {
throw new NullPointerException("child");
}
return children.stream()
.filter(n -> !n.isEmpty())
.filter(n -> n.getData().get().equals(child))
.findAny();
return children.stream().filter(node -> {
final Optional<T> d = node.getData();
return d.isPresent() && d.get().equals(child);
}).findAny();
}
@Override