diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authz/privilege/IndexPrivilege.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authz/privilege/IndexPrivilege.java index f93af05cfd7b1..5da75d5717edf 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authz/privilege/IndexPrivilege.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authz/privilege/IndexPrivilege.java @@ -34,6 +34,7 @@ import org.elasticsearch.action.support.IndexComponentSelector; import org.elasticsearch.cluster.metadata.DataStream; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.util.set.Sets; import org.elasticsearch.core.Nullable; import org.elasticsearch.index.seqno.RetentionLeaseActions; import org.elasticsearch.xpack.core.ccr.action.ForgetFollowerAction; @@ -452,8 +453,8 @@ private static IndexPrivilege union( Collection actions, IndexComponentSelectorPredicate selectorPredicate ) { - final Set automata = HashSet.newHashSet(privileges.size() + actions.size()); - final Set names = HashSet.newHashSet(privileges.size() + actions.size()); + final Set automata = Sets.newHashSetWithExpectedSize(privileges.size() + actions.size()); + final Set names = Sets.newHashSetWithExpectedSize(privileges.size() + actions.size()); for (IndexPrivilege privilege : privileges) { names.addAll(privilege.name()); automata.add(privilege.automaton);