private static int compareNodes(Sortable node1, Sortable node2) { int result = node1.getNodeWeight() - node2.getNodeWeight(); if (0 == result) { result = StringUtils.stringCompare(node1.getText(), node2.getText()); } return result; }