2121import java .util .ArrayList ;
2222import java .util .Collections ;
2323import java .util .HashMap ;
24+ import java .util .HashSet ;
2425import java .util .List ;
2526import java .util .Map ;
27+ import java .util .Set ;
2628import java .util .concurrent .ConcurrentHashMap ;
2729
2830import javax .annotation .Nonnull ;
@@ -37,7 +39,7 @@ public class HoldoutConfig {
3739 private Map <String , Holdout > holdoutIdMap ;
3840 private Map <String , List <Holdout >> flagHoldoutsMap ;
3941 private Map <String , List <Holdout >> includedHoldouts ;
40- private Map <String , List <Holdout >> excludedHoldouts ;
42+ private Map <String , Set <Holdout >> excludedHoldouts ;
4143
4244 /**
4345 * Initializes a new HoldoutConfig with an empty list of holdouts.
@@ -93,7 +95,7 @@ private void updateHoldoutMapping() {
9395 global .add (holdout );
9496
9597 for (String flagId : holdout .getExcludedFlags ()) {
96- excludedHoldouts .computeIfAbsent (flagId , k -> new ArrayList <>()).add (holdout );
98+ excludedHoldouts .computeIfAbsent (flagId , k -> new HashSet <>()).add (holdout );
9799 }
98100 }
99101 }
@@ -119,7 +121,7 @@ public List<Holdout> getHoldoutForFlag(@Nonnull String id) {
119121
120122 // Prioritize global holdouts first
121123 List <Holdout > activeHoldouts = new ArrayList <>();
122- List <Holdout > excluded = excludedHoldouts .getOrDefault (id , Collections .emptyList ());
124+ Set <Holdout > excluded = excludedHoldouts .getOrDefault (id , Collections .emptySet ());
123125
124126 if (!excluded .isEmpty ()) {
125127 for (Holdout holdout : global ) {
0 commit comments