[ 
https://issues.apache.org/jira/browse/KAFKA-9402?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

highluck resolved KAFKA-9402.
-----------------------------
    Resolution: Not A Problem

> PartitionStates update Improvement Opinion
> ------------------------------------------
>
>                 Key: KAFKA-9402
>                 URL: https://issues.apache.org/jira/browse/KAFKA-9402
>             Project: Kafka
>          Issue Type: Improvement
>    Affects Versions: 2.4.0
>            Reporter: highluck
>            Assignee: highluck
>            Priority: Minor
>              Labels: client
>
> PartitionStates update Improvement Opinion
>  
> PartitionStates#update 
>  
> {code:java}
> //
>         LinkedHashMap<String, List<TopicPartition>> topicToPartitions = new 
> LinkedHashMap<>();
>         for (TopicPartition tp : partitionToState.keySet()) {
>             List<TopicPartition> partitions = 
> topicToPartitions.computeIfAbsent(tp.topic(), k -> new ArrayList<>());
>             partitions.add(tp);
>         }
>         for (Map.Entry<String, List<TopicPartition>> entry : 
> topicToPartitions.entrySet()) {
>             for (TopicPartition tp : entry.getValue()) {
>                 S state = partitionToState.get(tp);
>                 map.put(tp, state);
>             }
>         }
> {code}
> I think it's complicated by order.
>  
> It is a part that can be improved more simply
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to