JBIterable<ServiceViewItem> (Condition<? super ServiceViewItem> visitChildrenCondition, Condition<? super ServiceViewItem> condition, boolean safe) { return JBTreeTraverser.from((Function<ServiceViewItem, List<ServiceViewItem>>)node -> visitChildrenCondition.value(node) ? new ArrayList<>(node.getChildren()) : null) .withRoots(myRoots) .traverse(safe ? ONLY_LOADED_BFS : NOT_LOADED_LAST_BFS) .filter(condition); }