void (ParentNode node, final Comparator<? super ElementNode> sortComparator) { ArrayList<ElementNode> arrayList = new ArrayList<>(); Enumeration<TreeNode> children = node.children(); while (children.hasMoreElements()) { arrayList.add((ElementNode)children.nextElement()); } arrayList.sort(sortComparator); replaceChildren(node, arrayList); }