72 instantiations of SegmentedHashSet
Microsoft.CodeAnalysis (6)
ImmutableSegmentedHashSet`1.cs (3)
16
public static readonly ImmutableSegmentedHashSet<T> Empty = new(new
SegmentedHashSet
<T>());
61
var set = new
SegmentedHashSet
<T>(self.KeyComparer) { value };
263
return new ImmutableSegmentedHashSet<T>(new
SegmentedHashSet
<T>(self._set, equalityComparer));
ImmutableSegmentedHashSet`1+Builder.cs (3)
47
_mutableSet = new
SegmentedHashSet
<T>(ReadOnlySet, value ?? EqualityComparer<T>.Default);
67
_mutableSet = new
SegmentedHashSet
<T>(originalSet._set, originalSet.KeyComparer);
89
_mutableSet = new
SegmentedHashSet
<T>(KeyComparer);
Microsoft.CodeAnalysis.UnitTests (66)
Collections\HashSet\SegmentedHashSet_Generic_Tests.cs (8)
60
return new
SegmentedHashSet
<int>(new WrapStructural_Int());
84
return new
SegmentedHashSet
<SimpleInt>(new WrapStructural_SimpleInt());
98
return new
SegmentedHashSet
<EquatableBackwardsOrder>();
117
return new
SegmentedHashSet
<int>(new Comparer_SameAsDefaultComparer());
136
return new
SegmentedHashSet
<int>(new Comparer_HashCodeAlwaysReturnsZero());
160
return new
SegmentedHashSet
<int>(new Comparer_ModOfInt(15000));
179
return new
SegmentedHashSet
<int>(new Comparer_AbsOfInt());
198
return new
SegmentedHashSet
<int>(new BadIntEqualityComparer());
Collections\HashSet\SegmentedHashSet_Generic_Tests`1.cs (56)
36
return new
SegmentedHashSet
<T>();
56
SegmentedHashSet<T> set = new
SegmentedHashSet
<T>();
64
SegmentedHashSet<T> set = new
SegmentedHashSet
<T>(comparer);
75
SegmentedHashSet<T> set = new
SegmentedHashSet
<T>(comparer);
89
SegmentedHashSet<T> set = new
SegmentedHashSet
<T>(enumerable);
98
SegmentedHashSet<T> hashSetFromDuplicates = new
SegmentedHashSet
<T>(Enumerable.Range(0, 40).SelectMany(i => items).ToArray());
99
SegmentedHashSet<T> hashSetFromNoDuplicates = new
SegmentedHashSet
<T>(items);
112
SegmentedHashSet<T> set = new
SegmentedHashSet
<T>(source, GetIEqualityComparer());
119
Assert.Throws<ArgumentNullException>(() => new
SegmentedHashSet
<T>((IEnumerable<T>)null!));
120
Assert.Throws<ArgumentNullException>(() => new
SegmentedHashSet
<T>((IEnumerable<T>)null!, EqualityComparer<T>.Default));
131
SegmentedHashSet<T> set = new
SegmentedHashSet
<T>(enumerable, GetIEqualityComparer());
163
SegmentedHashSet<object> set = new
SegmentedHashSet
<object>();
294
var set = new
SegmentedHashSet
<SegmentedHashSet<T>>()
296
new
SegmentedHashSet
<T> { objects[0], objects[1], objects[2] },
297
new
SegmentedHashSet
<T> { objects[3], objects[4], objects[5] }
300
var noComparerSet = new
SegmentedHashSet
<SegmentedHashSet<T>>()
302
new
SegmentedHashSet
<T> { objects[0], objects[1], objects[2] },
303
new
SegmentedHashSet
<T> { objects[3], objects[4], objects[5] }
306
var comparerSet1 = new
SegmentedHashSet
<SegmentedHashSet<T>>(SegmentedHashSet<T>.CreateSetComparer())
308
new
SegmentedHashSet
<T> { objects[0], objects[1], objects[2] },
309
new
SegmentedHashSet
<T> { objects[3], objects[4], objects[5] }
312
var comparerSet2 = new
SegmentedHashSet
<SegmentedHashSet<T>>(SegmentedHashSet<T>.CreateSetComparer())
314
new
SegmentedHashSet
<T> { objects[3], objects[4], objects[5] },
315
new
SegmentedHashSet
<T> { objects[0], objects[1], objects[2] }
328
var set = new
SegmentedHashSet
<SegmentedHashSet<T>>()
330
new
SegmentedHashSet
<T> { objects[0], objects[1], objects[2] },
331
new
SegmentedHashSet
<T> { objects[3], objects[4], objects[5] }
334
var noComparerSet = new
SegmentedHashSet
<SegmentedHashSet<T>>()
336
new
SegmentedHashSet
<T> { objects[0], objects[1], objects[2] },
337
new
SegmentedHashSet
<T> { objects[3], objects[4], objects[5] }
340
var comparerSet = new
SegmentedHashSet
<SegmentedHashSet<T>>(SegmentedHashSet<T>.CreateSetComparer())
342
new
SegmentedHashSet
<T> { objects[0], objects[1], objects[2] },
343
new
SegmentedHashSet
<T> { objects[3], objects[4], objects[5] }
356
SegmentedHashSet<T> set = new
SegmentedHashSet
<T>();
365
SegmentedHashSet<T> set = new
SegmentedHashSet
<T>(capacity);
373
SegmentedHashSet<T> set = new
SegmentedHashSet
<T>(capacity);
387
var set = new
SegmentedHashSet
<T>(Capacity);
397
Assert.Throws<ArgumentOutOfRangeException>("capacity", () => new
SegmentedHashSet
<T>(-1));
398
Assert.Throws<ArgumentOutOfRangeException>("capacity", () => new
SegmentedHashSet
<T>(int.MinValue));
406
SegmentedHashSet<T> set = new
SegmentedHashSet
<T>(capacity, comparer);
419
SegmentedHashSet<T> set = new
SegmentedHashSet
<T>(capacity, comparer);
432
Assert.Throws<ArgumentOutOfRangeException>("capacity", () => new
SegmentedHashSet
<T>(-1, comparer));
433
Assert.Throws<ArgumentOutOfRangeException>("capacity", () => new
SegmentedHashSet
<T>(int.MinValue, comparer));
442
SegmentedHashSet<T> set = new
SegmentedHashSet
<T> { value };
456
SegmentedHashSet<T> set = new
SegmentedHashSet
<T> { value };
473
SegmentedHashSet<T> set = new
SegmentedHashSet
<T> { value };
483
SegmentedHashSet<T> set = new
SegmentedHashSet
<T> { value };
517
var set = new
SegmentedHashSet
<T>();
524
var set = new
SegmentedHashSet
<T>();
535
var set = new
SegmentedHashSet
<T>();
549
set = new
SegmentedHashSet
<T>(currentCapacity);
559
var set = new
SegmentedHashSet
<T>(capacity);
616
var set = new
SegmentedHashSet
<T>();
619
set = new
SegmentedHashSet
<T>();
622
set = new
SegmentedHashSet
<T>();
652
var set = new
SegmentedHashSet
<T>(capacity, c);
Collections\HashSet\SegmentedHashSet_IEnumerable_NonGeneric_Tests.cs (1)
22
var set = new
SegmentedHashSet
<string>();
Collections\List\TestBase.Generic.cs (1)
227
SegmentedHashSet<T> set = new
SegmentedHashSet
<T>(GetIEqualityComparer());
157 references to SegmentedHashSet
Microsoft.CodeAnalysis (73)
ImmutableSegmentedHashSet`1.cs (3)
18
private readonly
SegmentedHashSet
<T> _set;
20
private ImmutableSegmentedHashSet(
SegmentedHashSet
<T> set)
61
var
set = new SegmentedHashSet<T>(self.KeyComparer) { value };
ImmutableSegmentedHashSet`1+Builder.cs (5)
26
private
SegmentedHashSet
<T>? _mutableSet;
55
private
SegmentedHashSet
<T> ReadOnlySet => _mutableSet ?? _set._set;
59
private
SegmentedHashSet
<T> GetOrCreateMutableSet()
142
SegmentedHashSet
<T>? mutableSet = null;
238
SegmentedHashSet
<T>? mutableSet = null;
ImmutableSegmentedHashSet`1+Enumerator.cs (3)
16
private readonly
SegmentedHashSet
<T> _set;
17
private
SegmentedHashSet
<T>.Enumerator _enumerator;
19
internal Enumerator(
SegmentedHashSet
<T> set)
ImmutableSegmentedHashSet`1+PrivateInterlocked.cs (3)
19
var
set = Volatile.Read(ref Unsafe.AsRef(in location._set));
28
var
set = Interlocked.Exchange(ref Unsafe.AsRef(in location._set), value._set);
37
var
set = Interlocked.CompareExchange(ref Unsafe.AsRef(in location._set), value._set, comparand._set);
SegmentedHashSet`1.cs (54)
95
if (collection is
SegmentedHashSet
<T> otherAsHashSet && EqualityComparersAreEqual(this, otherAsHashSet))
135
private void ConstructFrom(
SegmentedHashSet
<T> source)
181
/// <summary>Removes all elements from the <see cref="
SegmentedHashSet
{T}"/> object.</summary>
198
/// <summary>Determines whether the <see cref="
SegmentedHashSet
{T}"/> contains the specified element.</summary>
199
/// <param name="item">The element to locate in the <see cref="
SegmentedHashSet
{T}"/> object.</param>
200
/// <returns>true if the <see cref="
SegmentedHashSet
{T}"/> object contains the specified element; otherwise, false.</returns>
376
/// <summary>Adds the specified element to the <see cref="
SegmentedHashSet
{T}"/>.</summary>
378
/// <returns>true if the element is added to the <see cref="
SegmentedHashSet
{T}"/> object; false if the element is already present.</returns>
407
/// <summary>Modifies the current <see cref="
SegmentedHashSet
{T}"/> object to contain all elements that are present in itself, the specified collection, or both.</summary>
408
/// <param name="other">The collection to compare to the current <see cref="
SegmentedHashSet
{T}"/> object.</param>
422
/// <summary>Modifies the current <see cref="
SegmentedHashSet
{T}"/> object to contain only elements that are present in that object and in the specified collection.</summary>
423
/// <param name="other">The collection to compare to the current <see cref="
SegmentedHashSet
{T}"/> object.</param>
449
if (other is
SegmentedHashSet
<T> otherAsSet && EqualityComparersAreEqual(this, otherAsSet))
459
/// <summary>Removes all elements in the specified collection from the current <see cref="
SegmentedHashSet
{T}"/> object.</summary>
460
/// <param name="other">The collection to compare to the current <see cref="
SegmentedHashSet
{T}"/> object.</param>
488
/// <summary>Modifies the current <see cref="
SegmentedHashSet
{T}"/> object to contain only elements that are present either in that object or in the specified collection, but not both.</summary>
489
/// <param name="other">The collection to compare to the current <see cref="
SegmentedHashSet
{T}"/> object.</param>
516
if (other is
SegmentedHashSet
<T> otherAsSet && EqualityComparersAreEqual(this, otherAsSet))
526
/// <summary>Determines whether a <see cref="
SegmentedHashSet
{T}"/> object is a subset of the specified collection.</summary>
527
/// <param name="other">The collection to compare to the current <see cref="
SegmentedHashSet
{T}"/> object.</param>
528
/// <returns>true if the <see cref="
SegmentedHashSet
{T}"/> object is a subset of <paramref name="other"/>; otherwise, false.</returns>
545
if (other is
SegmentedHashSet
<T> otherAsSet && EqualityComparersAreEqual(this, otherAsSet))
562
/// <summary>Determines whether a <see cref="
SegmentedHashSet
{T}"/> object is a proper subset of the specified collection.</summary>
563
/// <param name="other">The collection to compare to the current <see cref="
SegmentedHashSet
{T}"/> object.</param>
564
/// <returns>true if the <see cref="
SegmentedHashSet
{T}"/> object is a proper subset of <paramref name="other"/>; otherwise, false.</returns>
593
if (other is
SegmentedHashSet
<T> otherAsSet && EqualityComparersAreEqual(this, otherAsSet))
610
/// <summary>Determines whether a <see cref="
SegmentedHashSet
{T}"/> object is a proper superset of the specified collection.</summary>
611
/// <param name="other">The collection to compare to the current <see cref="
SegmentedHashSet
{T}"/> object.</param>
612
/// <returns>true if the <see cref="
SegmentedHashSet
{T}"/> object is a superset of <paramref name="other"/>; otherwise, false.</returns>
636
if (other is
SegmentedHashSet
<T> otherAsSet &&
647
/// <summary>Determines whether a <see cref="
SegmentedHashSet
{T}"/> object is a proper superset of the specified collection.</summary>
648
/// <param name="other">The collection to compare to the current <see cref="
SegmentedHashSet
{T}"/> object.</param>
649
/// <returns>true if the <see cref="
SegmentedHashSet
{T}"/> object is a proper superset of <paramref name="other"/>; otherwise, false.</returns>
673
if (other is
SegmentedHashSet
<T> otherAsSet && EqualityComparersAreEqual(this, otherAsSet))
690
/// <summary>Determines whether the current <see cref="
SegmentedHashSet
{T}"/> object and a specified collection share common elements.</summary>
691
/// <param name="other">The collection to compare to the current <see cref="
SegmentedHashSet
{T}"/> object.</param>
692
/// <returns>true if the <see cref="
SegmentedHashSet
{T}"/> object and <paramref name="other"/> share at least one common element; otherwise, false.</returns>
722
/// <summary>Determines whether a <see cref="
SegmentedHashSet
{T}"/> object and the specified collection contain the same elements.</summary>
723
/// <param name="other">The collection to compare to the current <see cref="
SegmentedHashSet
{T}"/> object.</param>
724
/// <returns>true if the <see cref="
SegmentedHashSet
{T}"/> object is equal to <paramref name="other"/>; otherwise, false.</returns>
739
if (other is
SegmentedHashSet
<T> otherAsSet && EqualityComparersAreEqual(this, otherAsSet))
769
/// <summary>Copies the elements of a <see cref="
SegmentedHashSet
{T}"/> object to an array, starting at the specified array index.</summary>
813
/// <summary>Removes all elements that match the conditions defined by the specified predicate from a <see cref="
SegmentedHashSet
{T}"/> collection.</summary>
907
/// Sets the capacity of a <see cref="
SegmentedHashSet
{T}"/> object to the actual number of elements it contains,
949
/// <summary>Returns an <see cref="IEqualityComparer"/> object that can be used for equality testing of a <see cref="
SegmentedHashSet
{T}"/> object.</summary>
950
public static IEqualityComparer<
SegmentedHashSet
<T>> CreateSetComparer() => new SegmentedHashSetEqualityComparer<T>();
974
/// <returns>true if the element is added to the <see cref="
SegmentedHashSet
{T}"/> object; false if the element is already present.</returns>
1128
internal bool IsSubsetOfHashSetWithSameComparer(
SegmentedHashSet
<T> other)
1145
private void IntersectWithHashSetWithSameComparer(
SegmentedHashSet
<T> other)
1212
private void SymmetricExceptWithUniqueHashSet(
SegmentedHashSet
<T> other)
1370
internal static bool EqualityComparersAreEqual(
SegmentedHashSet
<T> set1,
SegmentedHashSet
<T> set2) => set1.Comparer.Equals(set2.Comparer);
1388
private readonly
SegmentedHashSet
<T> _hashSet;
1393
internal Enumerator(
SegmentedHashSet
<T> hashSet)
SegmentedHashSetEqualityComparer`1.cs (5)
16
internal sealed class SegmentedHashSetEqualityComparer<T> : IEqualityComparer<
SegmentedHashSet
<T>?>
18
public bool Equals(
SegmentedHashSet
<T>? x,
SegmentedHashSet
<T>? y)
36
if (
SegmentedHashSet
<T>.EqualityComparersAreEqual(x, y))
64
public int GetHashCode(
SegmentedHashSet
<T>? obj)
Microsoft.CodeAnalysis.UnitTests (84)
Collections\HashSet\SegmentedHashSet_Generic_Tests`1.cs (79)
56
SegmentedHashSet
<T> set = new SegmentedHashSet<T>();
64
SegmentedHashSet
<T> set = new SegmentedHashSet<T>(comparer);
75
SegmentedHashSet
<T> set = new SegmentedHashSet<T>(comparer);
89
SegmentedHashSet
<T> set = new SegmentedHashSet<T>(enumerable);
98
SegmentedHashSet
<T> hashSetFromDuplicates = new SegmentedHashSet<T>(Enumerable.Range(0, 40).SelectMany(i => items).ToArray());
99
SegmentedHashSet
<T> hashSetFromNoDuplicates = new SegmentedHashSet<T>(items);
107
SegmentedHashSet
<T> source = (
SegmentedHashSet
<T>)CreateEnumerable(EnumerableType.SegmentedHashSet, null, count, 0, 0);
112
SegmentedHashSet
<T> set = new SegmentedHashSet<T>(source, GetIEqualityComparer());
131
SegmentedHashSet
<T> set = new SegmentedHashSet<T>(enumerable, GetIEqualityComparer());
143
SegmentedHashSet
<T> set = (
SegmentedHashSet
<T>)GenericISetFactory(setLength);
152
SegmentedHashSet
<T> set = (
SegmentedHashSet
<T>)GenericISetFactory(setLength);
163
SegmentedHashSet
<object> set = new SegmentedHashSet<object>();
176
SegmentedHashSet
<T> set = (
SegmentedHashSet
<T>)GenericISetFactory(setLength);
188
SegmentedHashSet
<T> set = (
SegmentedHashSet
<T>)GenericISetFactory(setLength);
196
SegmentedHashSet
<T> set = (
SegmentedHashSet
<T>)GenericISetFactory(setLength);
210
SegmentedHashSet
<T> set = (
SegmentedHashSet
<T>)GenericISetFactory(setLength);
229
SegmentedHashSet
<T> set = (
SegmentedHashSet
<T>)GenericISetFactory(setLength);
247
SegmentedHashSet
<T> set = (
SegmentedHashSet
<T>)GenericISetFactory(setLength);
267
SegmentedHashSet
<T> set = (
SegmentedHashSet
<T>)GenericISetFactory(count);
277
SegmentedHashSet
<T> set = (
SegmentedHashSet
<T>)GenericISetFactory(count);
294
var
set = new SegmentedHashSet<
SegmentedHashSet
<T>>()
300
var
noComparerSet = new SegmentedHashSet<
SegmentedHashSet
<T>>()
306
var
comparerSet1 = new SegmentedHashSet<
SegmentedHashSet
<T>>(
SegmentedHashSet
<T>.CreateSetComparer())
312
var
comparerSet2 = new SegmentedHashSet<
SegmentedHashSet
<T>>(
SegmentedHashSet
<T>.CreateSetComparer())
328
var
set = new SegmentedHashSet<
SegmentedHashSet
<T>>()
334
var
noComparerSet = new SegmentedHashSet<
SegmentedHashSet
<T>>()
340
var
comparerSet = new SegmentedHashSet<
SegmentedHashSet
<T>>(
SegmentedHashSet
<T>.CreateSetComparer())
347
Assert.True(noComparerSet.SequenceEqual(set,
SegmentedHashSet
<T>.CreateSetComparer()));
356
SegmentedHashSet
<T> set = new SegmentedHashSet<T>();
365
SegmentedHashSet
<T> set = new SegmentedHashSet<T>(capacity);
373
SegmentedHashSet
<T> set = new SegmentedHashSet<T>(capacity);
387
var
set = new SegmentedHashSet<T>(Capacity);
406
SegmentedHashSet
<T> set = new SegmentedHashSet<T>(capacity, comparer);
419
SegmentedHashSet
<T> set = new SegmentedHashSet<T>(capacity, comparer);
442
SegmentedHashSet
<T> set = new SegmentedHashSet<T> { value };
456
SegmentedHashSet
<T> set = new SegmentedHashSet<T> { value };
473
SegmentedHashSet
<T> set = new SegmentedHashSet<T> { value };
483
SegmentedHashSet
<T> set = new SegmentedHashSet<T> { value };
500
SegmentedHashSet
<T> set = (
SegmentedHashSet
<T>)(GenericISetFactory(setLength));
517
var
set = new SegmentedHashSet<T>();
524
var
set = new SegmentedHashSet<T>();
535
var
set = new SegmentedHashSet<T>();
544
SegmentedHashSet
<T> set;
559
var
set = new SegmentedHashSet<T>(capacity);
562
set = (
SegmentedHashSet
<T>)GenericISetFactory(capacity);
574
SegmentedHashSet
<T> set = (
SegmentedHashSet
<T>)GenericISetFactory(setLength);
578
set = (
SegmentedHashSet
<T>)GenericISetFactory(setLength);
582
set = (
SegmentedHashSet
<T>)GenericISetFactory(setLength);
594
SegmentedHashSet
<T> set = (
SegmentedHashSet
<T>)GenericISetFactory(setLength);
603
SegmentedHashSet
<T> set = (
SegmentedHashSet
<T>)GenericISetFactory(setLength);
616
var
set = new SegmentedHashSet<T>();
631
SegmentedHashSet
<T> set = (
SegmentedHashSet
<T>)GenericISetFactory(setLength);
652
var
set = new SegmentedHashSet<T>(capacity, c);
Collections\HashSet\SegmentedHashSet_IEnumerable_NonGeneric_Tests.cs (4)
22
var
set = new SegmentedHashSet<string>();
44
SegmentedHashSet
<string> casted = ((
SegmentedHashSet
<string>)enumerable);
55
private protected static string CreateT(
SegmentedHashSet
<string> set, int seed)
Collections\List\TestBase.Generic.cs (1)
227
SegmentedHashSet
<T> set = new SegmentedHashSet<T>(GetIEqualityComparer());