Skip to content

Commit abd2bdd

Browse files
authored
Use Sets.newHashSetWithExpectedSize (#125327)
IJ complains about the static method not being available -- I don't see a reason against using the regular constructor here instead.
1 parent 160ac69 commit abd2bdd

File tree

1 file changed

+3
-2
lines changed
  • x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authz/privilege

1 file changed

+3
-2
lines changed

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authz/privilege/IndexPrivilege.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import org.elasticsearch.action.support.IndexComponentSelector;
3535
import org.elasticsearch.cluster.metadata.DataStream;
3636
import org.elasticsearch.common.Strings;
37+
import org.elasticsearch.common.util.set.Sets;
3738
import org.elasticsearch.core.Nullable;
3839
import org.elasticsearch.index.seqno.RetentionLeaseActions;
3940
import org.elasticsearch.xpack.core.ccr.action.ForgetFollowerAction;
@@ -452,8 +453,8 @@ private static IndexPrivilege union(
452453
Collection<String> actions,
453454
IndexComponentSelectorPredicate selectorPredicate
454455
) {
455-
final Set<Automaton> automata = HashSet.newHashSet(privileges.size() + actions.size());
456-
final Set<String> names = HashSet.newHashSet(privileges.size() + actions.size());
456+
final Set<Automaton> automata = Sets.newHashSetWithExpectedSize(privileges.size() + actions.size());
457+
final Set<String> names = Sets.newHashSetWithExpectedSize(privileges.size() + actions.size());
457458
for (IndexPrivilege privilege : privileges) {
458459
names.addAll(privilege.name());
459460
automata.add(privilege.automaton);

0 commit comments

Comments
 (0)