Refactor 2026 Day06 dictionary merge to reuse existing value
This commit is contained in:
1 parent
bfbd68bd83
commit
2f10206d01
1 file changed
+1
-1
+1
-1
@@ -36,7 +36,7 @@ public class Day06 : IPuzzleSolver<string>
|
|||||||
HashSet<TValue> value) where TKey : notnull
|
HashSet<TValue> value) where TKey : notnull
|
||||||
{
|
{
|
||||||
if(dictionary.TryGetValue(key, out var existing))
|
if(dictionary.TryGetValue(key, out var existing))
|
||||||
dictionary[key].UnionWith(value);
|
existing.UnionWith(value);
|
||||||
else
|
else
|
||||||
dictionary[key] = value;
|
dictionary[key] = value;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user