6 instantiations of HashBucket
System.Collections.Immutable (6)
System\Collections\Immutable\ImmutableDictionary_2.HashBucket.cs (6)
146
return new
HashBucket
(kv);
155
return new
HashBucket
(kv, _additionalElements);
178
return new
HashBucket
(_firstValue, _additionalElements.Add(kv));
186
return new
HashBucket
(_firstValue, _additionalElements.ReplaceAt(keyCollisionIndex, kv));
236
return new
HashBucket
(_additionalElements.Key, _additionalElements.RemoveAt(indexOfRootNode));
249
return new
HashBucket
(_firstValue, _additionalElements.RemoveAt(index));
70 references to HashBucket
System.Collections.Immutable (70)
System\Collections\Immutable\ImmutableDictionary_2.Builder.cs (5)
36
private SortedInt32KeyNode<
HashBucket
> _root = SortedInt32KeyNode<
HashBucket
>.EmptyNode;
96
var input = new MutationInput(SortedInt32KeyNode<
HashBucket
>.EmptyNode, comparers);
376
private SortedInt32KeyNode<
HashBucket
> Root
620
this.Root = SortedInt32KeyNode<
HashBucket
>.EmptyNode;
System\Collections\Immutable\ImmutableDictionary_2.Comparers.cs (6)
17
/// To reduce allocations, we directly implement the <see cref="
HashBucket
"/> and Key-Only comparers,
21
internal sealed class Comparers : IEqualityComparer<
HashBucket
>, IEqualityComparer<KeyValuePair<TKey, TValue>>
88
internal IEqualityComparer<
HashBucket
> HashBucketEqualityComparer
101
public bool Equals(
HashBucket
x,
HashBucket
y)
115
public int GetHashCode(
HashBucket
obj)
System\Collections\Immutable\ImmutableDictionary_2.cs (28)
28
private static readonly Action<KeyValuePair<int,
HashBucket
>> s_FreezeBucketAction = (kv) => kv.Value.Freeze();
38
private readonly SortedInt32KeyNode<
HashBucket
> _root;
51
private ImmutableDictionary(SortedInt32KeyNode<
HashBucket
> root, Comparers comparers, int count)
68
_root = SortedInt32KeyNode<
HashBucket
>.EmptyNode;
170
foreach (KeyValuePair<int, ImmutableDictionary<TKey, TValue>.
HashBucket
> bucket in _root)
187
foreach (KeyValuePair<int, ImmutableDictionary<TKey, TValue>.
HashBucket
> bucket in _root)
359
SortedInt32KeyNode<ImmutableDictionary<TKey, TValue>.
HashBucket
> root = _root;
363
HashBucket
bucket;
367
ImmutableDictionary<TKey, TValue>.
HashBucket
newBucket = bucket.Remove(key, _comparers.KeyOnlyComparer, out result);
671
internal SortedInt32KeyNode<
HashBucket
> Root
869
HashBucket
bucket;
884
HashBucket
bucket;
901
HashBucket
bucket;
917
HashBucket
bucket;
936
HashBucket
bucket = origin.Root.GetValueOrDefault(hashCode);
937
ImmutableDictionary<TKey, TValue>.
HashBucket
newBucket = bucket.Add(key, value, origin.KeyOnlyComparer, origin.ValueComparer, behavior, out result);
943
SortedInt32KeyNode<ImmutableDictionary<TKey, TValue>.
HashBucket
> newRoot = UpdateRoot(origin.Root, hashCode, newBucket, origin.HashBucketComparer);
955
SortedInt32KeyNode<ImmutableDictionary<TKey, TValue>.
HashBucket
> newRoot = origin.Root;
960
HashBucket
bucket = newRoot.GetValueOrDefault(hashCode);
962
ImmutableDictionary<TKey, TValue>.
HashBucket
newBucket = bucket.Add(pair.Key, pair.Value, origin.KeyOnlyComparer, origin.ValueComparer, collisionBehavior, out result);
979
HashBucket
bucket;
983
SortedInt32KeyNode<ImmutableDictionary<TKey, TValue>.
HashBucket
> newRoot = UpdateRoot(origin.Root, hashCode, bucket.Remove(key, origin.KeyOnlyComparer, out result), origin.HashBucketComparer);
993
private static SortedInt32KeyNode<
HashBucket
> UpdateRoot(SortedInt32KeyNode<
HashBucket
> root, int hashCode,
HashBucket
newBucket, IEqualityComparer<
HashBucket
> hashBucketComparer)
1016
private static ImmutableDictionary<TKey, TValue> Wrap(SortedInt32KeyNode<
HashBucket
> root, Comparers comparers, int count)
1030
private ImmutableDictionary<TKey, TValue> Wrap(SortedInt32KeyNode<
HashBucket
>? root, int adjustedCountIfDifferentRoot)
System\Collections\Immutable\ImmutableDictionary_2.Enumerator.cs (8)
26
private SortedInt32KeyNode<
HashBucket
>.Enumerator _mapEnumerator;
29
/// The enumerator in use within an individual <see cref="
HashBucket
"/>.
31
private
HashBucket
.Enumerator _bucketEnumerator;
43
internal Enumerator(SortedInt32KeyNode<
HashBucket
> root, Builder? builder = null)
46
_mapEnumerator = new SortedInt32KeyNode<
HashBucket
>.Enumerator(root);
47
_bucketEnumerator = default(
HashBucket
.Enumerator);
89
_bucketEnumerator = new
HashBucket
.Enumerator(_mapEnumerator.Current.Value);
107
_bucketEnumerator = default(
HashBucket
.Enumerator);
System\Collections\Immutable\ImmutableDictionary_2.HashBucket.cs (16)
11
/// Contains the inner <see cref="ImmutableDictionary{TKey, TValue}.
HashBucket
"/> struct.
37
/// Initializes a new instance of the <see cref="ImmutableDictionary{TKey, TValue}.
HashBucket
"/> struct.
113
/// Throws an exception to catch any errors in comparing <see cref="
HashBucket
"/> instances.
122
/// Throws an exception to catch any errors in comparing <see cref="
HashBucket
"/> instances.
138
/// <param name="result">A description of the effect was on adding an element to this <see cref="
HashBucket
"/>.</param>
139
/// <returns>A new <see cref="
HashBucket
"/> that contains the added value and any values already held by this <see cref="
HashBucket
"/>.</returns>
140
internal
HashBucket
Add(TKey key, TValue value, IEqualityComparer<KeyValuePair<TKey, TValue>> keyOnlyComparer, IEqualityComparer<TValue> valueComparer, KeyCollisionBehavior behavior, out OperationResult result)
212
/// <param name="result">A description of the effect was on adding an element to this <see cref="
HashBucket
"/>.</param>
213
/// <returns>A new <see cref="
HashBucket
"/> that does not contain the removed value and any values already held by this <see cref="
HashBucket
"/>.</returns>
214
internal
HashBucket
Remove(TKey key, IEqualityComparer<KeyValuePair<TKey, TValue>> keyOnlyComparer, out OperationResult result)
341
private readonly
HashBucket
_bucket;
349
/// The enumerator that represents the current position over the <see cref="_additionalElements"/> of the <see cref="
HashBucket
"/>.
354
/// Initializes a new instance of the <see cref="ImmutableDictionary{TKey, TValue}.
HashBucket
.Enumerator"/> struct.
357
internal Enumerator(
HashBucket
bucket)
System\Collections\Immutable\ImmutableDictionary_2.MutationInput.cs (4)
22
private readonly SortedInt32KeyNode<
HashBucket
> _root;
36
SortedInt32KeyNode<
HashBucket
> root,
56
internal SortedInt32KeyNode<
HashBucket
> Root
96
internal IEqualityComparer<
HashBucket
> HashBucketComparer
System\Collections\Immutable\ImmutableDictionary_2.MutationResult.cs (3)
19
private readonly SortedInt32KeyNode<
HashBucket
> _root;
41
internal MutationResult(SortedInt32KeyNode<
HashBucket
> root, int countAdjustment)
51
internal SortedInt32KeyNode<
HashBucket
> Root