public Comparator<Node> getSortComparator() {
        final Comparator<Node> result;
        switch(sortColumnNumber) {
            default:
                Log.warn("Unrecognized console.orderBy value: '{}'. Defaulting to 'NODE_IDENTIFIER'.", sortColumnNumber);
                // intended fall-through;
            case SORT_NODE_IDENTIFIER:
                result = Comparator.comparing(node -> node.getUniqueIdentifier().getNodeId().toLowerCase());
                break;
            case SORT_NODE_NAME:
                result = Comparator.comparing(node -> (node.getName() == null ? "" : node.getName()).toLowerCase());
                break;
            case SORT_NODE_DESCRIPTION:
                result = Comparator.comparing(node -> (node.getDescription() == null ? "" : node.getDescription()).toLowerCase());
                break;
            case SORT_ITEM_COUNT:
                result = Comparator.comparing(node -> node.getPublishedItems().size());
                break;
            case SORT_AFFILIATE_COUNT:
                result = Comparator.comparing(node -> node.getAllAffiliates().size());
                break;
            case SORT_SUBSCRIBER_COUNT:
                result = Comparator.comparing(node -> node.getAllSubscriptions().size());
                break;
        }
        if (sortOrder == DESCENDING) {
            // Natural ordering needs to be reversed.
            return result.reversed();
        } else {
            return result;
        }
    }
Returns a comparator that will sort a standard sorted set according to this filter's sort order.

@return a comparator that sorts Sessions matching the sort order for this filter.
xmppserver/src/main/java/org/jivesoftware/openfire/pubsub/PubsubNodeResultFilter.java