public static Map<Uuid, Set<Integer>> assignmentFromTopicPartitions(
        List<ConsumerGroupCurrentMemberAssignmentValue.TopicPartitions> topicPartitionsList
    ) {
        return topicPartitionsList.stream().collect(Collectors.toMap(
            ConsumerGroupCurrentMemberAssignmentValue.TopicPartitions::topicId,
            topicPartitions -> Collections.unmodifiableSet(new HashSet<>(topicPartitions.partitions()))));
    }
Creates a map of topic id and partition set from a list of consumer group TopicPartitions.

@param topicPartitionsList   The list of TopicPartitions.
@return a map of topic id and partition set.
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/Utils.java