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())); }