File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
fastfilter/src/main/java/org/fastfilter/xorplus Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -118,7 +118,14 @@ public XorPlus8(long[] keys) {
118118 // we usually execute this loop just once. If we detect a cycle (which is extremely unlikely)
119119 // then we try again, with a new random seed.
120120 long seed = 0 ;
121+ int attempts = 0 ;
121122 do {
123+ attempts ++;
124+ if (attempts >= 100 ) {
125+ // if the same key appears more than once in the keys array, every attempt to build the table will yield a collision
126+ throw new IllegalArgumentException ("Unable to construct the table after 100 attempts; likely indicates duplicate keys" );
127+ }
128+
122129 seed = Hash .randomSeed ();
123130 // we use an second table t2 to keep the list of all keys that map
124131 // to a given entry (with a broken hash function, all keys could map
You can’t perform that action at this time.
0 commit comments