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) {
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue