private List<ConfigKey> sortedConfigs() {
        final Map<String, Integer> groupOrd = new HashMap<>(groups.size());
        int ord = 0;
        for (String group: groups) {
            groupOrd.put(group, ord++);
        }

        List<ConfigKey> configs = new ArrayList<>(configKeys.values());
        Collections.sort(configs, (k1, k2) -> compare(k1, k2, groupOrd));
        return configs;
    }
Get a list of configs sorted taking the 'group' and 'orderInGroup' into account.

If grouping is not specified, the result will reflect "natural" order: listing required fields first, then ordering by importance, and finally by name.
clients/src/main/java/org/apache/kafka/common/config/ConfigDef.java