From 93bf96589471acadfb90e57ebfecbd91f679f77b Mon Sep 17 00:00:00 2001 From: wenhoujx Date: Wed, 19 Jun 2019 00:28:05 -0400 Subject: [PATCH] KAFKA-8559: Allocate ArrayList with correct size in PartitionStates (#6964) Reviewers: Ismael Juma --- .../java/org/apache/kafka/common/internals/PartitionStates.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clients/src/main/java/org/apache/kafka/common/internals/PartitionStates.java b/clients/src/main/java/org/apache/kafka/common/internals/PartitionStates.java index 22e183ab238..daad3550738 100644 --- a/clients/src/main/java/org/apache/kafka/common/internals/PartitionStates.java +++ b/clients/src/main/java/org/apache/kafka/common/internals/PartitionStates.java @@ -89,7 +89,7 @@ public class PartitionStates { * Returns the partition states in order. */ public List> partitionStates() { - List> result = new ArrayList<>(); + List> result = new ArrayList<>(map.size()); for (Map.Entry entry : map.entrySet()) { result.add(new PartitionState<>(entry.getKey(), entry.getValue())); }