int[] (@Nullable Collection<? extends TreeNode> children) { if (children == null) return ArrayUtilRt.EMPTY_INT_ARRAY; final int[] ints = new int[children.size()]; int i = 0; for (TreeNode node : children) { ints[i++] = getIndex(node); } Arrays.sort(ints); return ints; }