int (NodeDescriptor o1, NodeDescriptor o2) { boolean isParent1 = myStructure._getChildElements(o1.getElement(), false).length > 0; boolean isParent2 = myStructure._getChildElements(o2.getElement(), false).length > 0; int result = AlphaComparator.INSTANCE.compare(o1, o2); if (isParent1) { result -= 1000; } if (isParent2) { result += 1000; } return result; }