diff --git a/src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/Utils/HashLookup.cs b/src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/Utils/HashLookup.cs index 08ac4fa0995abf..f70eb86911d789 100644 --- a/src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/Utils/HashLookup.cs +++ b/src/libraries/System.Linq.Parallel/src/System/Linq/Parallel/Utils/HashLookup.cs @@ -22,7 +22,6 @@ internal sealed class HashLookup private int[] buckets; private Slot[] slots; private int count; - private int freeList; private readonly IEqualityComparer? comparer; private const int HashCodeMask = 0x7fffffff; @@ -36,7 +35,6 @@ internal HashLookup(IEqualityComparer? comparer) this.comparer = comparer; buckets = new int[7]; slots = new Slot[7]; - freeList = -1; } // If value is not in set, add it and return true; otherwise return false @@ -97,18 +95,10 @@ private bool Find(TKey key, bool add, bool set, [MaybeNullWhen(false)] ref TValu if (add) { - int index; - if (freeList >= 0) - { - index = freeList; - freeList = slots[index].next; - } - else - { - if (count == slots.Length) Resize(); - index = count; - count++; - } + if (count == slots.Length) Resize(); + + int index = count; + count++; int bucket = hashCode % buckets.Length; slots[index].hashCode = hashCode;