Chia-Ping Tsai created KAFKA-21454:
--------------------------------------

             Summary: DescribeShareGroupOffsetsRequest could leverage mapKey to 
avoid creating extra collection
                 Key: KAFKA-21454
                 URL: https://issues.apache.org/jira/browse/KAFKA-21454
             Project: Kafka
          Issue Type: Improvement
            Reporter: Chia-Ping Tsai
            Assignee: Chia-Ping Tsai


 
{code:java}
                Map<String, DescribeShareGroupOffsetsRequestTopic> 
requestTopics = new HashMap<>();
                for (TopicPartition tp : spec.topicPartitions()) {
                    requestTopics.computeIfAbsent(tp.topic(), t ->
                            new DescribeShareGroupOffsetsRequestTopic()
                                .setTopicName(tp.topic())
                                .setPartitions(new ArrayList<>()))
                        .partitions()
                        .add(tp.partition());
                }
{code}
The {{requestTopics}} map could be removed if {{TopicName}} is marked as 
{{{}mapKey{}}}.

 



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to