void (@NotNull N node, @NotNull Condition<? super U> filter) { Set<U> acceptedSet = createUserObjectSet(); List<U> acceptedList = new ArrayList<>(); for (U child : getChildren(getUserObject(node))) { if (filter.value(child)) { acceptedSet.add(child); acceptedList.add(child); } } removeNotAccepted(node, acceptedSet); mergeAcceptedNodes(node, acceptedList); }