List<NodeContent> (@NotNull Obsolescent obsolescent, int count, @NotNull IntFunction<?> function) { if (count < 0) LOG.warn("illegal child count: " + count); if (count <= 0) return emptyList(); List<NodeContent> list = new ArrayList<>(count); for (int index = 0; index < count; index++) { checkCanceled(); if (obsolescent.isObsolete()) return emptyList(); Object node = function.apply(index); if (node == null) { LOG.warn("ignore null child at " + index); } else if (list.stream().anyMatch(content -> content.hasUserNode(node))) { LOG.warn("ignore duplicated child at " + index + ": " + node); } else { if (obsolescent.isObsolete()) return emptyList(); list.add(new NodeContent(node, LeafState.get(node, model))); } } return list; }