void (List<InlineWatchNode> inlines) { List<? extends InlineWatchNode> children = getInlineWatchChildren(); int[] indices = inlines.stream().mapToInt(node -> children.indexOf(node)).filter(ind -> ind >= 0).toArray(); TreeNode[] removed = Arrays.stream(indices).mapToObj(ind -> ((TreeNode)children.get(ind))).toArray(s -> new TreeNode[s]); children.removeAll(inlines); if (indices.length > 0) { inlineNodesRemoved(indices, removed); } if (children.isEmpty()) { allChildrenRemoved(); } }