public static SubscriptionType subscriptionType(
        Map<String, Integer> subscribedTopicNames,
        int numberOfMembers
    ) {
        if (subscribedTopicNames.isEmpty()) {
            return HOMOGENEOUS;
        }

        for (int subscriberCount : subscribedTopicNames.values()) {
            if (subscriberCount != numberOfMembers) {
                return HETEROGENEOUS;
            }
        }
        return HOMOGENEOUS;
    }
Compute the subscription type of the consumer group.

@param subscribedTopicNames      A map of topic names to the count of members subscribed to each topic.

@return {@link SubscriptionType#HOMOGENEOUS} if all members are subscribed to exactly the same topics;
        otherwise, {@link SubscriptionType#HETEROGENEOUS}.
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/modern/ModernGroup.java