Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ FillFromEmpty()

ImmutableSortedDictionary< TKey, TValue > System.Collections.Immutable.ImmutableSortedDictionary< TKey, TValue >.FillFromEmpty ( IEnumerable< KeyValuePair< TKey, TValue > > items,
bool overwriteOnCollision )
inlineprivate

Definition at line 1443 of file ImmutableSortedDictionary.cs.

1444 {
1445 Requires.NotNull(items, "items");
1446 if (TryCastToImmutableMap(items, out var other))
1447 {
1448 return other.WithComparers(KeyComparer, ValueComparer);
1449 }
1452 {
1454 }
1455 else
1456 {
1458 foreach (KeyValuePair<TKey, TValue> item in items)
1459 {
1460 TValue value;
1462 {
1463 sortedDictionary[item.Key] = item.Value;
1464 }
1465 else if (sortedDictionary.TryGetValue(item.Key, out value))
1466 {
1467 if (!_valueComparer.Equals(value, item.Value))
1468 {
1470 }
1471 }
1472 else
1473 {
1474 sortedDictionary.Add(item.Key, item.Value);
1475 }
1476 }
1477 }
1478 if (sortedDictionary.Count == 0)
1479 {
1480 return this;
1481 }
1482 Node root = Node.NodeTreeFromSortedDictionary(sortedDictionary);
1484 }
bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value)
void Add(TKey key, TValue value)
static bool TryCastToImmutableMap(IEnumerable< KeyValuePair< TKey, TValue > > sequence, [NotNullWhen(true)] out ImmutableSortedDictionary< TKey, TValue > other)
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string DuplicateKey
Definition SR.cs:28
Definition SR.cs:7
new bool Equals(object? x, object? y)

References System.Collections.Immutable.ImmutableSortedDictionary< TKey, TValue >._valueComparer, System.Collections.Generic.Dictionary< TKey, TValue >.Add(), System.Collections.Generic.Dictionary< TKey, TValue >.Count, System.dictionary, System.SR.DuplicateKey, System.Collections.IEqualityComparer.Equals(), System.SR.Format(), System.item, System.Collections.Immutable.ImmutableSortedDictionary< TKey, TValue >.KeyComparer, System.Collections.Immutable.ImmutableSortedDictionary< TKey, TValue >.Node.NodeTreeFromSortedDictionary(), System.other, System.Collections.Immutable.ImmutableSortedDictionary< TKey, TValue >.TryCastToImmutableMap(), System.Collections.Generic.Dictionary< TKey, TValue >.TryGetValue(), System.value, and System.Collections.Immutable.ImmutableSortedDictionary< TKey, TValue >.ValueComparer.

Referenced by System.Collections.Immutable.ImmutableSortedDictionary< TKey, TValue >.AddRange().