[New] Added Activity.streamActionsDeep() and use for findActionsDeep()
This commit is contained in:
parent
d373c08f55
commit
bca8b16184
|
@ -410,7 +410,7 @@ public class Activity extends AbstractStrolchRootElement
|
|||
}
|
||||
|
||||
public List<Action> findActionsDeep(Predicate<IActivityElement> predicate) {
|
||||
return getActionsAsFlatList().stream().filter(predicate).collect(toList());
|
||||
return streamActionsDeep().filter(predicate).collect(toList());
|
||||
}
|
||||
|
||||
public List<IActivityElement> getElementsByType(String type) {
|
||||
|
@ -437,6 +437,14 @@ public class Activity extends AbstractStrolchRootElement
|
|||
return this.elements.values().stream();
|
||||
}
|
||||
|
||||
public Stream<Action> streamActionsDeep() {
|
||||
return streamElements().flatMap(e -> {
|
||||
if (e.isAction())
|
||||
return Stream.of(e);
|
||||
return e.asActivity().streamActionsDeep();
|
||||
}).map(IActivityElement::asAction);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all the actions as a flat list
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue