public static ProfiledConnectionEntry[] getSortedQueries(Type type, boolean sortByTime) {
        Map<String, ProfiledConnectionEntry> queries = switch (type) {
            case select -> selectQueries;
            case update -> updateQueries;
            case insert -> insertQueries;
            case delete -> deleteQueries;
        };

        // No queries, return null
        if (queries.isEmpty()) {
            return null;
        }

        ProfiledConnectionEntry[] result = queries.values().toArray(new ProfiledConnectionEntry[0]);

        quickSort(result, sortByTime, 0, result.length - 1);
        return result;
    }
Returns an array of sorted queries (as ProfiledConnectionEntry objects) by type

@param type       the type of query to check
@param sortByTime sort the resulting list by Time if true,
                  otherwise sort by count if false (default)
@return an array of ProfiledConnectionEntry objects
xmppserver/src/main/java/org/jivesoftware/database/ProfiledConnection.java