NodeItem.findChild(): rewrite stream filter
This commit is contained in:
parent
2da1d9aa3d
commit
1b0b022281
1 changed files with 4 additions and 4 deletions
|
@ -255,10 +255,10 @@ public class NodeItem<T> implements Node<T> {
|
||||||
if (child == null) {
|
if (child == null) {
|
||||||
throw new NullPointerException("child");
|
throw new NullPointerException("child");
|
||||||
}
|
}
|
||||||
return children.stream()
|
return children.stream().filter(node -> {
|
||||||
.filter(n -> !n.isEmpty())
|
final Optional<T> d = node.getData();
|
||||||
.filter(n -> n.getData().get().equals(child))
|
return d.isPresent() && d.get().equals(child);
|
||||||
.findAny();
|
}).findAny();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue