diff --git a/.editorconfig b/.editorconfig index c5fcd3d..8fbb96b 100644 --- a/.editorconfig +++ b/.editorconfig @@ -133,3 +133,6 @@ csharp_space_between_method_declaration_name_and_open_parenthesis = false csharp_space_between_method_declaration_parameter_list_parentheses = false csharp_space_between_parentheses = false csharp_space_between_square_brackets = false + +# RS0041: Public members should not use oblivious types +dotnet_diagnostic.RS0041.severity = none diff --git a/Directory.Build.props b/Directory.Build.props index c70d02c..2486c10 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -2,10 +2,21 @@ - 7.3 + 8.0 strict + + + enable + false + + + + + + + true @@ -58,7 +69,7 @@ - + diff --git a/NuGet.Config b/NuGet.Config new file mode 100644 index 0000000..074030c --- /dev/null +++ b/NuGet.Config @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/TunnelVisionLabs.Collections.Trees.Experimental/PublicAPI.Shipped.txt b/TunnelVisionLabs.Collections.Trees.Experimental/PublicAPI.Shipped.txt index e69de29..7dc5c58 100644 --- a/TunnelVisionLabs.Collections.Trees.Experimental/PublicAPI.Shipped.txt +++ b/TunnelVisionLabs.Collections.Trees.Experimental/PublicAPI.Shipped.txt @@ -0,0 +1 @@ +#nullable enable diff --git a/TunnelVisionLabs.Collections.Trees.Experimental/PublicAPI.Unshipped.txt b/TunnelVisionLabs.Collections.Trees.Experimental/PublicAPI.Unshipped.txt index e69de29..7dc5c58 100644 --- a/TunnelVisionLabs.Collections.Trees.Experimental/PublicAPI.Unshipped.txt +++ b/TunnelVisionLabs.Collections.Trees.Experimental/PublicAPI.Unshipped.txt @@ -0,0 +1 @@ +#nullable enable diff --git a/TunnelVisionLabs.Collections.Trees.Experimental/TunnelVisionLabs.Collections.Trees.Experimental.csproj b/TunnelVisionLabs.Collections.Trees.Experimental/TunnelVisionLabs.Collections.Trees.Experimental.csproj index 7062e86..8e961b7 100644 --- a/TunnelVisionLabs.Collections.Trees.Experimental/TunnelVisionLabs.Collections.Trees.Experimental.csproj +++ b/TunnelVisionLabs.Collections.Trees.Experimental/TunnelVisionLabs.Collections.Trees.Experimental.csproj @@ -2,7 +2,7 @@ - net45;netstandard1.1;netstandard2.0 + net45;netstandard1.1;netstandard2.0;netstandard2.1 TunnelVisionLabs.Collections.Trees true diff --git a/TunnelVisionLabs.Collections.Trees.Test/AbstractSetTest.cs b/TunnelVisionLabs.Collections.Trees.Test/AbstractSetTest.cs index 6c37a8d..192fbe2 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/AbstractSetTest.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/AbstractSetTest.cs @@ -16,7 +16,7 @@ public abstract class AbstractSetTest public void TestUnionWith() { ISet set = CreateSet(); - Assert.Throws(() => set.UnionWith(null)); + Assert.Throws(() => set.UnionWith(null!)); set.UnionWith(TransformEnumerableForSetOperation(Enumerable.Range(0, 7))); set.UnionWith(TransformEnumerableForSetOperation(Enumerable.Range(5, 5))); @@ -27,7 +27,7 @@ public void TestUnionWith() public void TestExceptWith() { ISet set = CreateSet(); - Assert.Throws(() => set.ExceptWith(null)); + Assert.Throws(() => set.ExceptWith(null!)); // Return without iterating if the set is already empty set.ExceptWith(EverythingThrowsEnumerable.Instance); @@ -49,7 +49,7 @@ public void TestExceptWith() public void TestIntersectWith() { ISet set = CreateSet(); - Assert.Throws(() => set.IntersectWith(null)); + Assert.Throws(() => set.IntersectWith(null!)); // Return without iterating if the set is already empty set.IntersectWith(EverythingThrowsEnumerable.Instance); @@ -76,7 +76,7 @@ public void TestSymmetricExceptWith() { ISet set = CreateSet(); ISet second = CreateSet(); - Assert.Throws(() => set.SymmetricExceptWith(null)); + Assert.Throws(() => set.SymmetricExceptWith(null!)); // Test behavior when the current set is empty set.SymmetricExceptWith(TransformEnumerableForSetOperation(new[] { 1, 5, 3 })); @@ -110,7 +110,7 @@ public void TestSymmetricExceptWith() public void TestIsProperSubsetOf() { ISet set = CreateSet(); - Assert.Throws(() => set.IsProperSubsetOf(null)); + Assert.Throws(() => set.IsProperSubsetOf(null!)); // Test behavior when the current set is empty Assert.False(set.IsProperSubsetOf(TransformEnumerableForSetOperation(Enumerable.Empty()))); @@ -145,7 +145,7 @@ public void TestIsProperSubsetOf() public void TestIsProperSupersetOf() { ISet set = CreateSet(); - Assert.Throws(() => set.IsProperSupersetOf(null)); + Assert.Throws(() => set.IsProperSupersetOf(null!)); // Return without iterating if the set is already empty Assert.False(set.IsProperSupersetOf(EverythingThrowsEnumerable.Instance)); @@ -183,7 +183,7 @@ public void TestIsProperSupersetOf() public void TestIsSubsetOf() { ISet set = CreateSet(); - Assert.Throws(() => set.IsSubsetOf(null)); + Assert.Throws(() => set.IsSubsetOf(null!)); // Return without iterating if the set is already empty Assert.True(set.IsSubsetOf(EverythingThrowsEnumerable.Instance)); @@ -217,7 +217,7 @@ public void TestIsSubsetOf() public void TestIsSupersetOf() { ISet set = CreateSet(); - Assert.Throws(() => set.IsSupersetOf(null)); + Assert.Throws(() => set.IsSupersetOf(null!)); // Test IsSupersetOf self set.Add(1); @@ -252,7 +252,7 @@ public void TestIsSupersetOf() public void TestOverlaps() { ISet set = CreateSet(); - Assert.Throws(() => set.Overlaps(null)); + Assert.Throws(() => set.Overlaps(null!)); // Return without iterating if the set is already empty Assert.False(set.Overlaps(EverythingThrowsEnumerable.Instance)); @@ -272,7 +272,7 @@ public void TestOverlaps() public void TestSetEquals() { ISet set = CreateSet(); - Assert.Throws(() => set.SetEquals(null)); + Assert.Throws(() => set.SetEquals(null!)); // Test behavior when the current set is empty Assert.True(set.SetEquals(TransformEnumerableForSetOperation(Enumerable.Empty()))); @@ -341,7 +341,7 @@ protected static void TestICollectionInterfaceImpl(ICollection collection, bool { var copy = new object[collection.Count]; - Assert.Throws(() => collection.CopyTo(null, 0)); + Assert.Throws(() => collection.CopyTo(null!, 0)); Assert.Throws(() => collection.CopyTo(new object[1, collection.Count], 0)); Assert.Throws(() => collection.CopyTo(Array.CreateInstance(typeof(object), lengths: new[] { collection.Count }, lowerBounds: new[] { -1 }), 0)); Assert.Throws(() => collection.CopyTo(copy, -1)); @@ -368,7 +368,7 @@ protected static void TestICollectionInterfaceImpl(ICollection collection, bool { var copy = new int[collection.Count]; - Assert.Throws(() => collection.CopyTo(null, 0)); + Assert.Throws(() => collection.CopyTo(null!, 0)); Assert.Throws(() => collection.CopyTo(new int[1, collection.Count], 0)); Assert.Throws(() => collection.CopyTo(Array.CreateInstance(typeof(int), lengths: new[] { collection.Count }, lowerBounds: new[] { -1 }), 0)); Assert.Throws(() => collection.CopyTo(copy, -1)); diff --git a/TunnelVisionLabs.Collections.Trees.Test/GeneratorTest.cs b/TunnelVisionLabs.Collections.Trees.Test/GeneratorTest.cs index 2c19b7f..fbf23c3 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/GeneratorTest.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/GeneratorTest.cs @@ -3,6 +3,7 @@ namespace TunnelVisionLabs.Collections.Trees.Test { + using System.Diagnostics; using System.Reflection; using Xunit; @@ -23,7 +24,8 @@ public void TestSeed() void ResetSeed(int? seed) { - FieldInfo seedField = typeof(Generator).GetField("_seed", BindingFlags.Static | BindingFlags.NonPublic); + FieldInfo? seedField = typeof(Generator).GetField("_seed", BindingFlags.Static | BindingFlags.NonPublic); + Debug.Assert(seedField is object, $"Assertion failed: {nameof(seedField)} is object"); seedField.SetValue(null, seed); } } diff --git a/TunnelVisionLabs.Collections.Trees.Test/Immutable/AbstractImmutableDictionaryTest.cs b/TunnelVisionLabs.Collections.Trees.Test/Immutable/AbstractImmutableDictionaryTest.cs index 0842ccd..2b8aa50 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/Immutable/AbstractImmutableDictionaryTest.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/Immutable/AbstractImmutableDictionaryTest.cs @@ -162,6 +162,7 @@ public void TestRemove() dictionary.Remove(1)); } - protected abstract IImmutableDictionary CreateDictionary(); + protected abstract IImmutableDictionary CreateDictionary() + where TKey : notnull; } } diff --git a/TunnelVisionLabs.Collections.Trees.Test/Immutable/AbstractImmutableSetTest.cs b/TunnelVisionLabs.Collections.Trees.Test/Immutable/AbstractImmutableSetTest.cs index e2610cf..477ffa9 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/Immutable/AbstractImmutableSetTest.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/Immutable/AbstractImmutableSetTest.cs @@ -331,7 +331,7 @@ protected static void TestICollectionInterfaceImpl(ICollection collection, bool Assert.NotNull(collection.SyncRoot); Assert.Same(collection, collection.SyncRoot); - Assert.Throws("array", () => collection.CopyTo(null, 0)); + Assert.Throws("array", () => collection.CopyTo(null!, 0)); Assert.Throws(() => collection.CopyTo(new int[collection.Count, 1], 0)); void CopyToArrayWithNonZeroLowerBound() => collection.CopyTo(Array.CreateInstance(typeof(int), lengths: new[] { collection.Count }, lowerBounds: new[] { 1 }), 0); diff --git a/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableSortedTreeDictionaryBuilderTest.cs b/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableSortedTreeDictionaryBuilderTest.cs index f1d1110..8591a8e 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableSortedTreeDictionaryBuilderTest.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableSortedTreeDictionaryBuilderTest.cs @@ -78,7 +78,7 @@ public void TestRemoveRange() dictionary.RemoveRange(itemsToRemove); Assert.Equal(new[] { 1, 3, 5, 7, 9 }.Select(x => new KeyValuePair(x, x)), dictionary); - Assert.Throws("keys", () => dictionary.RemoveRange(null)); + Assert.Throws("keys", () => dictionary.RemoveRange(null!)); } [Fact] @@ -132,7 +132,7 @@ public void TestIDictionaryT() Assert.Equal(Enumerable.Range(0, 9), dictionary.Values); Assert.Throws(() => dictionary.Keys.Add(0)); - Assert.Throws("array", () => dictionary.Keys.CopyTo(null, 0)); + Assert.Throws("array", () => dictionary.Keys.CopyTo(null!, 0)); Assert.Throws("arrayIndex", () => dictionary.Keys.CopyTo(new int[dictionary.Count], -1)); Assert.Throws("arrayIndex", () => dictionary.Keys.CopyTo(new int[dictionary.Count], dictionary.Count + 1)); Assert.Throws(() => dictionary.Keys.CopyTo(new int[dictionary.Count], 1)); @@ -162,7 +162,7 @@ public void TestIDictionaryT() Assert.Equal(0, keyEnumerator.Current); Assert.Throws(() => dictionary.Values.Add(0)); - Assert.Throws("array", () => dictionary.Values.CopyTo(null, 0)); + Assert.Throws("array", () => dictionary.Values.CopyTo(null!, 0)); Assert.Throws("arrayIndex", () => dictionary.Values.CopyTo(new int[dictionary.Count], -1)); Assert.Throws("arrayIndex", () => dictionary.Values.CopyTo(new int[dictionary.Count], dictionary.Count + 1)); Assert.Throws(() => dictionary.Values.CopyTo(new int[dictionary.Count], 1)); @@ -215,7 +215,7 @@ public void TestIDictionary() Assert.False(dictionary.IsReadOnly); Assert.False(dictionary.IsSynchronized); - Assert.Throws("key", () => dictionary.Add(key: null, value: 1)); + Assert.Throws("key", () => dictionary.Add(key: null!, value: 1)); Assert.Throws("value", () => dictionary.Add(key: 1, value: null)); Assert.Throws("key", () => dictionary.Add(key: "string value", value: 0)); Assert.Throws("value", () => dictionary.Add(key: 0, value: "string value")); @@ -228,11 +228,11 @@ public void TestIDictionary() dictionary.Add(10, 11); Assert.Equal(11, dictionary.Count); - Assert.Throws("key", () => dictionary[key: null]); + Assert.Throws("key", () => dictionary[key: null!]); Assert.Null(dictionary["string key"]); Assert.Equal(11, dictionary[10]); - Assert.Throws("key", () => dictionary[key: null] = 12); + Assert.Throws("key", () => dictionary[key: null!] = 12); Assert.Throws("key", () => dictionary["string key"] = 12); Assert.Throws("value", () => dictionary[10] = null); Assert.Throws("value", () => dictionary[10] = "string value"); @@ -247,11 +247,11 @@ public void TestIDictionary() Assert.Equal(entries.Select(i => i.Key), dictionary.Keys.Cast()); Assert.Equal(entries.Select(i => i.Value), dictionary.Values.Cast()); - Assert.Throws(() => dictionary.Contains(null)); + Assert.Throws(() => dictionary.Contains(null!)); Assert.False(dictionary.Contains("string value")); Assert.True(dictionary.Contains(10)); - Assert.Throws(() => dictionary.Remove(null)); + Assert.Throws(() => dictionary.Remove(null!)); Assert.Equal(11, dictionary.Count); dictionary.Remove("string value"); Assert.Equal(11, dictionary.Count); @@ -300,7 +300,7 @@ void TestCollection(ICollection collection, Func indexToExpectedValue Assert.False(collection.IsSynchronized); Assert.Same(dictionary, collection.SyncRoot); - Assert.Throws("array", () => collection.CopyTo(null, 0)); + Assert.Throws("array", () => collection.CopyTo(null!, 0)); Assert.Throws(() => collection.CopyTo(new int[collection.Count, 1], 0)); Assert.Throws(() => collection.CopyTo(Array.CreateInstance(typeof(int), lengths: new[] { collection.Count }, lowerBounds: new[] { 1 }), 0)); Assert.Throws("index", () => collection.CopyTo(new int[collection.Count], -1)); diff --git a/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableSortedTreeDictionaryTest.cs b/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableSortedTreeDictionaryTest.cs index 2579d11..ee837c0 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableSortedTreeDictionaryTest.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableSortedTreeDictionaryTest.cs @@ -134,21 +134,21 @@ public void TestImmutableSortedTreeDictionaryCreateRange() [Fact] public void TestImmutableSortedTreeDictionaryCreateRangeValidation() { - Assert.Throws("items", () => ImmutableSortedTreeDictionary.CreateRange(null)); - Assert.Throws("items", () => ImmutableSortedTreeDictionary.CreateRange(Comparer.Default, null)); - Assert.Throws("items", () => ImmutableSortedTreeDictionary.CreateRange(Comparer.Default, EqualityComparer.Default, null)); + Assert.Throws("items", () => ImmutableSortedTreeDictionary.CreateRange(null!)); + Assert.Throws("items", () => ImmutableSortedTreeDictionary.CreateRange(Comparer.Default, null!)); + Assert.Throws("items", () => ImmutableSortedTreeDictionary.CreateRange(Comparer.Default, EqualityComparer.Default, null!)); - Assert.Throws("items", () => default(IEnumerable>).ToImmutableSortedTreeDictionary()); - Assert.Throws("items", () => default(IEnumerable>).ToImmutableSortedTreeDictionary(Comparer.Default)); - Assert.Throws("items", () => default(IEnumerable>).ToImmutableSortedTreeDictionary(Comparer.Default, EqualityComparer.Default)); - Assert.Throws("source", () => default(IEnumerable>).ToImmutableSortedTreeDictionary(x => x.Key, x => x.Value, Comparer.Default)); - Assert.Throws("source", () => default(IEnumerable>).ToImmutableSortedTreeDictionary(x => x.Key, x => x.Value, Comparer.Default, EqualityComparer.Default)); + Assert.Throws("items", () => default(IEnumerable>)!.ToImmutableSortedTreeDictionary()); + Assert.Throws("items", () => default(IEnumerable>)!.ToImmutableSortedTreeDictionary(Comparer.Default)); + Assert.Throws("items", () => default(IEnumerable>)!.ToImmutableSortedTreeDictionary(Comparer.Default, EqualityComparer.Default)); + Assert.Throws("source", () => default(IEnumerable>)!.ToImmutableSortedTreeDictionary(x => x.Key, x => x.Value, Comparer.Default)); + Assert.Throws("source", () => default(IEnumerable>)!.ToImmutableSortedTreeDictionary(x => x.Key, x => x.Value, Comparer.Default, EqualityComparer.Default)); - Assert.Throws("keySelector", () => Enumerable.Empty>().ToImmutableSortedTreeDictionary(keySelector: null, x => x.Value, Comparer.Default)); - Assert.Throws("keySelector", () => Enumerable.Empty>().ToImmutableSortedTreeDictionary(keySelector: null, x => x.Value, Comparer.Default, EqualityComparer.Default)); + Assert.Throws("keySelector", () => Enumerable.Empty>().ToImmutableSortedTreeDictionary(keySelector: null!, x => x.Value, Comparer.Default)); + Assert.Throws("keySelector", () => Enumerable.Empty>().ToImmutableSortedTreeDictionary(keySelector: null!, x => x.Value, Comparer.Default, EqualityComparer.Default)); - Assert.Throws("elementSelector", () => Enumerable.Empty>().ToImmutableSortedTreeDictionary, string, int>(x => x.Key, elementSelector: null, Comparer.Default)); - Assert.Throws("elementSelector", () => Enumerable.Empty>().ToImmutableSortedTreeDictionary(x => x.Key, elementSelector: null, Comparer.Default, EqualityComparer.Default)); + Assert.Throws("elementSelector", () => Enumerable.Empty>().ToImmutableSortedTreeDictionary, string, int>(x => x.Key, elementSelector: null!, Comparer.Default)); + Assert.Throws("elementSelector", () => Enumerable.Empty>().ToImmutableSortedTreeDictionary(x => x.Key, elementSelector: null!, Comparer.Default, EqualityComparer.Default)); } [Fact] @@ -237,7 +237,7 @@ public void TestExplicitComparer() var intComparer = new ComparisonComparer((x, y) => 0); var comparableComparer = new ComparisonComparer((x, y) => 0); - ZeroHashCodeEqualityComparer objValueComparer = ZeroHashCodeEqualityComparer.Default; + ZeroHashCodeEqualityComparer objValueComparer = ZeroHashCodeEqualityComparer.Default; Assert.Same(objComparer, ImmutableSortedTreeDictionary.Create(keyComparer: objComparer).KeyComparer); Assert.Same(intComparer, ImmutableSortedTreeDictionary.Create(keyComparer: intComparer).KeyComparer); @@ -249,8 +249,8 @@ public void TestExplicitComparer() Assert.Same(Comparer.Default, ImmutableSortedTreeDictionary.Create(keyComparer: null, valueComparer: objValueComparer).KeyComparer); Assert.Same(objValueComparer, ImmutableSortedTreeDictionary.Create(keyComparer: null, valueComparer: objValueComparer).ValueComparer); - Assert.Same(Comparer.Default, ImmutableSortedTreeDictionary.Create().Add(new object(), null).WithComparers(keyComparer: null, valueComparer: objValueComparer).KeyComparer); - Assert.Same(objValueComparer, ImmutableSortedTreeDictionary.Create().Add(new object(), null).WithComparers(keyComparer: null, valueComparer: objValueComparer).ValueComparer); + Assert.Same(Comparer.Default, ImmutableSortedTreeDictionary.Create().Add(new object(), null).WithComparers(keyComparer: null, valueComparer: objValueComparer).KeyComparer); + Assert.Same(objValueComparer, ImmutableSortedTreeDictionary.Create().Add(new object(), null).WithComparers(keyComparer: null, valueComparer: objValueComparer).ValueComparer); } [Fact] @@ -283,7 +283,7 @@ public void TestIDictionaryT() Assert.Equal(Enumerable.Range(0, 9), dictionary.Values); Assert.Throws(() => dictionary.Keys.Add(0)); - Assert.Throws("array", () => dictionary.Keys.CopyTo(null, 0)); + Assert.Throws("array", () => dictionary.Keys.CopyTo(null!, 0)); Assert.Throws("arrayIndex", () => dictionary.Keys.CopyTo(new int[dictionary.Count], -1)); Assert.Throws("arrayIndex", () => dictionary.Keys.CopyTo(new int[dictionary.Count], dictionary.Count + 1)); Assert.Throws(() => dictionary.Keys.CopyTo(new int[dictionary.Count], 1)); @@ -301,7 +301,7 @@ public void TestIDictionaryT() Assert.Equal(0, keyEnumerator.Current); Assert.Throws(() => dictionary.Values.Add(0)); - Assert.Throws("array", () => dictionary.Values.CopyTo(null, 0)); + Assert.Throws("array", () => dictionary.Values.CopyTo(null!, 0)); Assert.Throws("arrayIndex", () => dictionary.Values.CopyTo(new int[dictionary.Count], -1)); Assert.Throws("arrayIndex", () => dictionary.Values.CopyTo(new int[dictionary.Count], dictionary.Count + 1)); Assert.Throws(() => dictionary.Values.CopyTo(new int[dictionary.Count], 1)); @@ -355,7 +355,7 @@ public void TestIDictionary() dictionary = Enumerable.Range(0, 11).ToImmutableSortedTreeDictionary(x => x, x => x + 1); - Assert.Throws("key", () => dictionary[key: null]); + Assert.Throws("key", () => dictionary[key: null!]); Assert.Null(dictionary["string key"]); Assert.Equal(11, dictionary[10]); @@ -370,7 +370,7 @@ public void TestIDictionary() Assert.Equal(entries.Select(i => i.Key), dictionary.Keys.Cast()); Assert.Equal(entries.Select(i => i.Value), dictionary.Values.Cast()); - Assert.Throws(() => dictionary.Contains(null)); + Assert.Throws(() => dictionary.Contains(null!)); Assert.False(dictionary.Contains("string value")); Assert.True(dictionary.Contains(10)); @@ -422,7 +422,7 @@ void TestCollection(ICollection collection, Func indexToExpectedValue Assert.True(collection.IsSynchronized); Assert.Same(dictionary, collection.SyncRoot); - Assert.Throws("array", () => collection.CopyTo(null, 0)); + Assert.Throws("array", () => collection.CopyTo(null!, 0)); Assert.Throws(() => collection.CopyTo(new int[collection.Count, 1], 0)); Assert.Throws(() => collection.CopyTo(Array.CreateInstance(typeof(int), lengths: new[] { collection.Count }, lowerBounds: new[] { 1 }), 0)); Assert.Throws("index", () => collection.CopyTo(new int[collection.Count], -1)); diff --git a/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableSortedTreeListBuilderTest.cs b/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableSortedTreeListBuilderTest.cs index 7fd2ee0..24ca6dd 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableSortedTreeListBuilderTest.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableSortedTreeListBuilderTest.cs @@ -21,7 +21,7 @@ public void TestSortedTreeListBuilderConstructor() Assert.Empty(list); Assert.Equal(Comparer.Default, list.Comparer); - ImmutableSortedTreeList.Builder stringList = ImmutableSortedTreeList.CreateBuilder(StringComparer.Ordinal); + ImmutableSortedTreeList.Builder stringList = ImmutableSortedTreeList.CreateBuilder(StringComparer.Ordinal); Assert.Same(StringComparer.Ordinal, stringList.Comparer); stringList = ImmutableSortedTreeList.CreateBuilder(StringComparer.OrdinalIgnoreCase); @@ -108,7 +108,7 @@ private static void TestIListInterfaceImpl(IList list, bool supportsNullValues) list.Remove("Text"); Assert.Equal(originalCount, list.Count); - object removedItem = list[0]; + object? removedItem = list[0]; list.Remove(list[0]); Assert.Equal(originalCount - 1, list.Count); Assert.True(list.Contains(removedItem)); @@ -240,7 +240,7 @@ public void TestIndexer() public void TestCopyToValidation() { var list = ImmutableSortedTreeList.CreateRange(Enumerable.Range(0, 10)).ToBuilder(); - Assert.Throws("array", () => list.CopyTo(0, null, 0, list.Count)); + Assert.Throws("array", () => list.CopyTo(0, null!, 0, list.Count)); Assert.Throws("index", () => list.CopyTo(-1, new int[list.Count], 0, list.Count)); Assert.Throws("arrayIndex", () => list.CopyTo(0, new int[list.Count], -1, list.Count)); Assert.Throws("count", () => list.CopyTo(0, new int[list.Count], 0, -1)); @@ -314,7 +314,7 @@ public void TestAddRange() int[] actual = list.ToArray(); Assert.Equal(expected, actual); - Assert.Throws(() => list.AddRange(null)); + Assert.Throws(() => list.AddRange(null!)); } [Fact] @@ -389,8 +389,8 @@ public void TestForEach() var list = ImmutableSortedTreeList.CreateRange(comparer: null, Enumerable.Range(0, 100)).ToBuilder(); var reference = new List(Enumerable.Range(0, 100)); - Assert.Throws("action", () => list.ForEach(null)); - Assert.Throws(() => reference.ForEach(null)); + Assert.Throws("action", () => list.ForEach(null!)); + Assert.Throws(() => reference.ForEach(null!)); var listOutput = new List(); var referenceOutput = new List(); @@ -541,9 +541,9 @@ public void TestFindIndex() reference.Sort(); - Assert.Throws(() => list.FindIndex(null)); - Assert.Throws(() => list.FindIndex(0, null)); - Assert.Throws(() => list.FindIndex(0, 0, null)); + Assert.Throws(() => list.FindIndex(null!)); + Assert.Throws(() => list.FindIndex(0, null!)); + Assert.Throws(() => list.FindIndex(0, 0, null!)); Assert.Throws(() => list.FindIndex(-1, i => true)); Assert.Throws(() => list.FindIndex(0, -1, i => true)); @@ -583,9 +583,9 @@ public void TestFindLastIndex() reference.Sort(); - Assert.Throws(() => list.FindLastIndex(null)); - Assert.Throws(() => list.FindLastIndex(-1, null)); - Assert.Throws(() => list.FindLastIndex(-1, 0, null)); + Assert.Throws(() => list.FindLastIndex(null!)); + Assert.Throws(() => list.FindLastIndex(-1, null!)); + Assert.Throws(() => list.FindLastIndex(-1, 0, null!)); Assert.Throws(() => list.FindLastIndex(list.Count, i => true)); Assert.Throws(() => list.FindLastIndex(list.Count - 1, -1, i => true)); @@ -731,7 +731,7 @@ public void TestRemoveValue() public void TestRemoveAll() { var list = ImmutableSortedTreeList.CreateRange(comparer: null, Enumerable.Range(0, 10)).ToBuilder(); - Assert.Throws(() => list.RemoveAll(null)); + Assert.Throws(() => list.RemoveAll(null!)); Assert.Equal(5, list.RemoveAll(i => (i % 2) == 0)); Assert.Equal(new[] { 1, 3, 5, 7, 9 }, list); @@ -743,7 +743,7 @@ public void TestRemoveAll() public void TestExists() { var list = ImmutableSortedTreeList.CreateRange(comparer: null, Enumerable.Range(0, 10)).ToBuilder(); - Assert.Throws(() => list.Exists(null)); + Assert.Throws(() => list.Exists(null!)); Assert.False(list.Exists(value => value < 0)); foreach (var i in list) @@ -758,7 +758,7 @@ public void TestExists() public void TestFind() { var list = ImmutableSortedTreeList.CreateRange(comparer: null, Enumerable.Range(1, 10)).ToBuilder(); - Assert.Throws(() => list.Find(null)); + Assert.Throws(() => list.Find(null!)); Assert.Equal(0, list.Find(value => value < 0)); foreach (var i in list) @@ -773,7 +773,7 @@ public void TestFind() public void TestFindAll() { var list = ImmutableSortedTreeList.CreateRange(comparer: null, Enumerable.Range(0, 10)).ToBuilder(); - Assert.Throws(() => list.FindAll(null)); + Assert.Throws(() => list.FindAll(null!)); ImmutableSortedTreeList found = list.FindAll(i => (i % 2) == 0); @@ -789,7 +789,7 @@ public void TestFindLast() { var list = ImmutableSortedTreeList.CreateRange(comparer: null, Enumerable.Range(1, 10)).ToBuilder(); var reference = new List(Enumerable.Range(1, 10)); - Assert.Throws(() => list.FindLast(null)); + Assert.Throws(() => list.FindLast(null!)); Assert.Equal(0, list.FindLast(i => i < 0)); Assert.Equal(0, reference.FindLast(i => i < 0)); @@ -824,7 +824,7 @@ public void TestTrueForAll() { ImmutableSortedTreeList.Builder list = ImmutableSortedTreeList.CreateBuilder(); Assert.True(list.TrueForAll(i => false)); - Assert.Throws(() => list.TrueForAll(null)); + Assert.Throws(() => list.TrueForAll(null!)); list.Add(1); Assert.True(list.TrueForAll(i => i > 0)); diff --git a/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableSortedTreeListTest+ForEach.cs b/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableSortedTreeListTest+ForEach.cs index b1aa07b..4e09c81 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableSortedTreeListTest+ForEach.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableSortedTreeListTest+ForEach.cs @@ -58,15 +58,15 @@ public void NegTest1() { int[] iArray = { 1, 9, 3, 6, -1, 8, 7, 1, 2, 4 }; var listObject = ImmutableSortedTreeList.Create(iArray); - Action action = null; - Assert.Throws(() => listObject.ForEach(action)); + Action? action = null; + Assert.Throws(() => listObject.ForEach(action!)); } public class MyClass { public int Sum { get; set; } = 0; - public string Result + public string? Result { get; set; } diff --git a/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableSortedTreeListTest.cs b/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableSortedTreeListTest.cs index a510c14..e98b2be 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableSortedTreeListTest.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableSortedTreeListTest.cs @@ -74,8 +74,8 @@ public void TestMultipleElementList() [Fact] public void TestImmutableSortedTreeListCreateValidation() { - Assert.Throws("items", () => ImmutableSortedTreeList.Create(default(int[]))); - Assert.Throws("items", () => ImmutableSortedTreeList.Create(Comparer.Default, default(int[]))); + Assert.Throws("items", () => ImmutableSortedTreeList.Create(default(int[])!)); + Assert.Throws("items", () => ImmutableSortedTreeList.Create(Comparer.Default, default(int[])!)); } [Fact] @@ -89,10 +89,10 @@ public void TestImmutableSortedTreeListCreateRange() [Fact] public void TestImmutableSortedTreeListCreateRangeValidation() { - Assert.Throws("items", () => ImmutableSortedTreeList.CreateRange(null)); - Assert.Throws("items", () => ImmutableSortedTreeList.CreateRange(Comparer.Default, null)); - Assert.Throws("items", () => default(IEnumerable).ToImmutableSortedTreeList()); - Assert.Throws("items", () => default(IEnumerable).ToImmutableSortedTreeList(Comparer.Default)); + Assert.Throws("items", () => ImmutableSortedTreeList.CreateRange(null!)); + Assert.Throws("items", () => ImmutableSortedTreeList.CreateRange(Comparer.Default, null!)); + Assert.Throws("items", () => default(IEnumerable)!.ToImmutableSortedTreeList()); + Assert.Throws("items", () => default(IEnumerable)!.ToImmutableSortedTreeList(Comparer.Default)); } [Fact] @@ -182,29 +182,29 @@ private static void TestIListTInterfaceImpl(IList list, bool supportsNullV { Assert.True(list.IsReadOnly); - Assert.Equal(600, list[0]); - Assert.Equal(601, list[1]); + Assert.Equal(600, list[0]); + Assert.Equal(601, list[1]); Assert.True(list.Contains((T)(object)600)); - Assert.False(list.Contains(default)); + Assert.False(list.Contains(default!)); Assert.Equal(0, list.IndexOf((T)(object)600)); Assert.Equal(1, list.IndexOf((T)(object)601)); - Assert.Equal(-1, list.IndexOf(default)); + Assert.Equal(-1, list.IndexOf(default!)); Assert.Throws(() => list[-1]); - Assert.Throws(() => list[-1] = default); + Assert.Throws(() => list[-1] = default!); Assert.Throws(() => list[list.Count]); - Assert.Throws(() => list[list.Count] = default); - Assert.Throws(() => list.Insert(-1, default)); - Assert.Throws(() => list.Insert(list.Count + 1, default)); + Assert.Throws(() => list[list.Count] = default!); + Assert.Throws(() => list.Insert(-1, default!)); + Assert.Throws(() => list.Insert(list.Count + 1, default!)); Assert.NotEqual(list[1], list[0]); Assert.Throws(() => list.Insert(0, list[0])); Assert.NotEqual(list[1], list[0]); int originalCount = list.Count; - Assert.Throws(() => list.Remove(default)); + Assert.Throws(() => list.Remove(default!)); Assert.Equal(originalCount, list.Count); Assert.Throws(() => list.RemoveAt(0)); Assert.Equal(originalCount, list.Count); @@ -216,27 +216,27 @@ private static void TestIListTInterfaceImpl(IList list, bool supportsNullV if (supportsNullValues) { - Assert.Throws(() => list.Add(default)); - Assert.NotEqual(default, list[list.Count - 1]); - Assert.False(list.Contains(default)); + Assert.Throws(() => list.Add(default!)); + Assert.NotEqual(default!, list[list.Count - 1]); + Assert.False(list.Contains(default!)); Assert.Equal(list.Count - 1, list.IndexOf((T)(object)601)); - Assert.Throws(() => list[list.Count - 1] = default); + Assert.Throws(() => list[list.Count - 1] = default!); Assert.Equal((T)(object)601, list[list.Count - 1]); - Assert.False(list.Contains(default)); - Assert.Equal(-1, list.IndexOf(default)); + Assert.False(list.Contains(default!)); + Assert.Equal(-1, list.IndexOf(default!)); - Assert.Throws(() => list[list.Count - 1] = default); - Assert.NotEqual(default, list[list.Count - 1]); + Assert.Throws(() => list[list.Count - 1] = default!); + Assert.NotEqual(default!, list[list.Count - 1]); } else { // In the face of two errors, verify consistent behavior - Assert.Throws(() => list[list.Count] = default); - Assert.Throws(() => list.Insert(-1, default)); + Assert.Throws(() => list[list.Count] = default!); + Assert.Throws(() => list.Insert(-1, default!)); - Assert.Throws(() => list.Add(default)); - Assert.Throws(() => list[list.Count - 1] = default); + Assert.Throws(() => list.Add(default!)); + Assert.Throws(() => list[list.Count - 1] = default!); Assert.Throws(() => list.Add(Activator.CreateInstance())); Assert.Throws(() => list[list.Count - 1] = Activator.CreateInstance()); Assert.Throws(() => list.Insert(0, Activator.CreateInstance())); @@ -275,7 +275,7 @@ private static void TestICollectionInterfaceImpl(ICollection collection, bool su Assert.NotNull(collection.SyncRoot); Assert.Same(collection, collection.SyncRoot); - Assert.Throws("array", () => collection.CopyTo(null, 0)); + Assert.Throws("array", () => collection.CopyTo(null!, 0)); Assert.Throws(() => collection.CopyTo(new int[collection.Count, 1], 0)); void CopyToArrayWithNonZeroLowerBound() => collection.CopyTo(Array.CreateInstance(typeof(int), lengths: new[] { collection.Count }, lowerBounds: new[] { 1 }), 0); @@ -358,45 +358,45 @@ private static void TestICollectionTInterfaceImpl(ICollection collection, var copy = new T[collection.Count]; Assert.Throws(() => collection.CopyTo(copy, -1)); - Assert.All(copy, item => Assert.Equal(default, item)); + Assert.All(copy, item => Assert.Equal(default!, item)); Assert.Throws(() => collection.CopyTo(copy, 1)); - Assert.All(copy, item => Assert.Equal(default, item)); + Assert.All(copy, item => Assert.Equal(default!, item)); collection.CopyTo(copy, 0); - Assert.Equal(600, copy[0]); - Assert.Equal(601, copy[1]); + Assert.Equal(600, copy[0]); + Assert.Equal(601, copy[1]); copy = new T[collection.Count + 2]; collection.CopyTo(copy, 1); - Assert.Equal(default, copy[0]); - Assert.Equal(600, copy[1]); - Assert.Equal(601, copy[2]); - Assert.Equal(default, copy[3]); + Assert.Equal(default!, copy[0]); + Assert.Equal(600, copy[1]); + Assert.Equal(601, copy[2]); + Assert.Equal(default!, copy[3]); } else { var copy = new T[collection.Count]; Assert.Throws(() => collection.CopyTo(copy, -1)); - Assert.All(copy, item => Assert.Equal(default, item)); + Assert.All(copy, item => Assert.Equal(default!, item)); Assert.Throws(() => collection.CopyTo(copy, 1)); - Assert.All(copy, item => Assert.Equal(default, item)); + Assert.All(copy, item => Assert.Equal(default!, item)); collection.CopyTo(copy, 0); - Assert.Equal(600, copy[0]); - Assert.Equal(601, copy[1]); + Assert.Equal(600, copy[0]); + Assert.Equal(601, copy[1]); copy = new T[collection.Count + 2]; collection.CopyTo(copy, 1); - Assert.Equal(default, copy[0]); - Assert.Equal(600, copy[1]); - Assert.Equal(601, copy[2]); - Assert.Equal(default, copy[3]); + Assert.Equal(default!, copy[0]); + Assert.Equal(600, copy[1]); + Assert.Equal(601, copy[2]); + Assert.Equal(default!, copy[3]); } Assert.Throws(() => collection.Clear()); - Assert.Throws(() => collection.Add(default)); - Assert.Throws(() => collection.Remove(default)); + Assert.Throws(() => collection.Add(default!)); + Assert.Throws(() => collection.Remove(default!)); } [Fact] @@ -414,8 +414,8 @@ public void TestIndexer() public void TestCopyToValidation() { ImmutableSortedTreeList list = ImmutableSortedTreeList.CreateRange(Enumerable.Range(0, 10)); - Assert.Throws("array", () => list.CopyTo(null)); - Assert.Throws("array", () => list.CopyTo(0, null, 0, list.Count)); + Assert.Throws("array", () => list.CopyTo(null!)); + Assert.Throws("array", () => list.CopyTo(0, null!, 0, list.Count)); Assert.Throws("index", () => list.CopyTo(-1, new int[list.Count], 0, list.Count)); Assert.Throws("arrayIndex", () => list.CopyTo(0, new int[list.Count], -1, list.Count)); Assert.Throws("count", () => list.CopyTo(0, new int[list.Count], 0, -1)); @@ -498,7 +498,7 @@ public void TestAddRange() ImmutableSortedTreeList list = ImmutableSortedTreeList.Create(); CollectionAssert.EnumeratorNotInvalidated(list, () => list = list.AddRange(expected)); - Assert.Throws("items", () => list.AddRange(null)); + Assert.Throws("items", () => list.AddRange(null!)); CollectionAssert.EnumeratorNotInvalidated(list, () => list.AddRange(Enumerable.Empty())); Assert.Equal(expected.Length, list.Count); @@ -691,9 +691,9 @@ public void TestFindIndex() reference.Add(i); } - Assert.Throws(() => list.FindIndex(null)); - Assert.Throws(() => list.FindIndex(0, null)); - Assert.Throws(() => list.FindIndex(0, 0, null)); + Assert.Throws(() => list.FindIndex(null!)); + Assert.Throws(() => list.FindIndex(0, null!)); + Assert.Throws(() => list.FindIndex(0, 0, null!)); Assert.Throws(() => list.FindIndex(-1, i => true)); Assert.Throws(() => list.FindIndex(0, -1, i => true)); @@ -730,9 +730,9 @@ public void TestFindLastIndex() reference.Add(i); } - Assert.Throws(() => list.FindLastIndex(null)); - Assert.Throws(() => list.FindLastIndex(-1, null)); - Assert.Throws(() => list.FindLastIndex(-1, 0, null)); + Assert.Throws(() => list.FindLastIndex(null!)); + Assert.Throws(() => list.FindLastIndex(-1, null!)); + Assert.Throws(() => list.FindLastIndex(-1, 0, null!)); Assert.Throws(() => list.FindLastIndex(list.Count, i => true)); Assert.Throws(() => list.FindLastIndex(list.Count - 1, -1, i => true)); @@ -828,7 +828,7 @@ public void TestRemoveRangeItems() Assert.IsType>(prunedViaInterface); Assert.Equal(referencePruned, prunedViaInterface); - Assert.Throws("items", () => list.RemoveRange(items: null)); + Assert.Throws("items", () => list.RemoveRange(items: null!)); Assert.Throws("items", () => ((IImmutableList)list).RemoveRange(items: null, equalityComparer: null)); } @@ -984,7 +984,7 @@ public void TestReplaceValue() public void TestRemoveAll() { var list = ImmutableSortedTreeList.CreateRange(Enumerable.Range(0, 20)); - Assert.Throws(() => list.RemoveAll(null)); + Assert.Throws(() => list.RemoveAll(null!)); Assert.Equal(10, list.Count - list.RemoveAll(i => (i % 2) == 0).Count); Assert.Equal(Enumerable.Range(0, 20), list); @@ -1002,7 +1002,7 @@ public void TestRemoveAll() public void TestExists() { var list = ImmutableSortedTreeList.CreateRange(Enumerable.Range(0, 20)); - Assert.Throws(() => list.Exists(null)); + Assert.Throws(() => list.Exists(null!)); Assert.False(list.Exists(value => value < 0)); foreach (var i in list) @@ -1017,7 +1017,7 @@ public void TestExists() public void TestFind() { var list = ImmutableSortedTreeList.CreateRange(Enumerable.Range(1, 20)); - Assert.Throws(() => list.Find(null)); + Assert.Throws(() => list.Find(null!)); Assert.Equal(0, list.Find(value => value < 0)); foreach (var i in list) @@ -1032,7 +1032,7 @@ public void TestFind() public void TestFindAll() { var list = ImmutableSortedTreeList.CreateRange(Enumerable.Range(0, 20)); - Assert.Throws(() => list.FindAll(null)); + Assert.Throws(() => list.FindAll(null!)); ImmutableSortedTreeList found = list.FindAll(i => (i % 2) == 0); @@ -1050,7 +1050,7 @@ public void TestFindLast() { var list = ImmutableSortedTreeList.CreateRange(Enumerable.Range(1, 20)); var reference = new List(Enumerable.Range(1, 20)); - Assert.Throws(() => list.FindLast(null)); + Assert.Throws(() => list.FindLast(null!)); Assert.Equal(0, list.FindLast(i => i < 0)); Assert.Equal(0, reference.FindLast(i => i < 0)); @@ -1067,7 +1067,7 @@ public void TestTrueForAll() { var list = ImmutableSortedTreeList.Create(); Assert.True(list.TrueForAll(i => false)); - Assert.Throws(() => list.TrueForAll(null)); + Assert.Throws(() => list.TrueForAll(null!)); list = list.Add(1); Assert.True(list.TrueForAll(i => i > 0)); diff --git a/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableSortedTreeSetBuilderTest.cs b/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableSortedTreeSetBuilderTest.cs index 15e125f..8e9fbbe 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableSortedTreeSetBuilderTest.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableSortedTreeSetBuilderTest.cs @@ -43,7 +43,7 @@ public void TestCollectionConstructorUsesCorrectComparer() Assert.Equal(2, objectSet.Count); Assert.Equal(new[] { instance1, instance2 }, objectSet); - ImmutableSortedTreeSet.Builder stringSet = ImmutableSortedTreeSet.CreateBuilder(); + ImmutableSortedTreeSet.Builder stringSet = ImmutableSortedTreeSet.CreateBuilder(); Assert.Same(Comparer.Default, stringSet.KeyComparer); stringSet = ImmutableSortedTreeSet.CreateBuilder(StringComparer.OrdinalIgnoreCase); @@ -121,7 +121,7 @@ public void TestICollectionInterface() public void TestCopyToValidation() { var set = ImmutableSortedTreeSet.CreateRange(Enumerable.Range(0, 10)).ToBuilder(); - Assert.Throws("array", () => ((ICollection)set).CopyTo(array: null, 0)); + Assert.Throws("array", () => ((ICollection)set).CopyTo(array: null!, 0)); Assert.Throws("arrayIndex", () => ((ICollection)set).CopyTo(new int[set.Count], -1)); Assert.Throws(string.Empty, () => ((ICollection)set).CopyTo(new int[set.Count - 1], 0)); Assert.Throws(string.Empty, () => ((ICollection)set).CopyTo(new int[set.Count], 1)); @@ -278,11 +278,11 @@ public void TestTrimExcess() [Fact] public void TestTryGetValue() { - ImmutableSortedTreeSet.Builder set = ImmutableSortedTreeSet.CreateBuilder(StringComparer.OrdinalIgnoreCase); + ImmutableSortedTreeSet.Builder set = ImmutableSortedTreeSet.CreateBuilder(StringComparer.OrdinalIgnoreCase); Assert.True(set.Add("a")); Assert.False(set.Add("A")); - Assert.True(set.TryGetValue("a", out string value)); + Assert.True(set.TryGetValue("a", out string? value)); Assert.Equal("a", value); Assert.True(set.TryGetValue("A", out value)); diff --git a/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableSortedTreeSetTest.cs b/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableSortedTreeSetTest.cs index d1d437d..ba11fbc 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableSortedTreeSetTest.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableSortedTreeSetTest.cs @@ -86,8 +86,8 @@ public void TestMultipleElementSet() [Fact] public void TestImmutableSortedTreeSetCreateValidation() { - Assert.Throws("other", () => ImmutableSortedTreeSet.Create(default(int[]))); - Assert.Throws("other", () => ImmutableSortedTreeSet.Create(Comparer.Default, default(int[]))); + Assert.Throws("other", () => ImmutableSortedTreeSet.Create(default(int[])!)); + Assert.Throws("other", () => ImmutableSortedTreeSet.Create(Comparer.Default, default(int[])!)); } [Fact] @@ -101,10 +101,10 @@ public void TestImmutableSortedTreeSetCreateRange() [Fact] public void TestImmutableSortedTreeSetCreateRangeValidation() { - Assert.Throws("other", () => ImmutableSortedTreeSet.CreateRange(null)); - Assert.Throws("other", () => ImmutableSortedTreeSet.CreateRange(Comparer.Default, null)); - Assert.Throws("source", () => default(IEnumerable).ToImmutableSortedTreeSet()); - Assert.Throws("source", () => default(IEnumerable).ToImmutableSortedTreeSet(Comparer.Default)); + Assert.Throws("other", () => ImmutableSortedTreeSet.CreateRange(null!)); + Assert.Throws("other", () => ImmutableSortedTreeSet.CreateRange(Comparer.Default, null!)); + Assert.Throws("source", () => default(IEnumerable)!.ToImmutableSortedTreeSet()); + Assert.Throws("source", () => default(IEnumerable)!.ToImmutableSortedTreeSet(Comparer.Default)); } [Fact] @@ -259,29 +259,29 @@ private static void TestIListTInterfaceImpl(IList list, bool supportsNullV { Assert.True(list.IsReadOnly); - Assert.Equal(600, list[0]); - Assert.Equal(601, list[1]); + Assert.Equal(600, list[0]); + Assert.Equal(601, list[1]); Assert.True(list.Contains((T)(object)600)); - Assert.False(list.Contains(default)); + Assert.False(list.Contains(default!)); Assert.Equal(0, list.IndexOf((T)(object)600)); Assert.Equal(1, list.IndexOf((T)(object)601)); - Assert.Equal(-1, list.IndexOf(default)); + Assert.Equal(-1, list.IndexOf(default!)); Assert.Throws(() => list[-1]); - Assert.Throws(() => list[-1] = default); + Assert.Throws(() => list[-1] = default!); Assert.Throws(() => list[list.Count]); - Assert.Throws(() => list[list.Count] = default); - Assert.Throws(() => list.Insert(-1, default)); - Assert.Throws(() => list.Insert(list.Count + 1, default)); + Assert.Throws(() => list[list.Count] = default!); + Assert.Throws(() => list.Insert(-1, default!)); + Assert.Throws(() => list.Insert(list.Count + 1, default!)); Assert.NotEqual(list[1], list[0]); Assert.Throws(() => list.Insert(0, list[0])); Assert.NotEqual(list[1], list[0]); int originalCount = list.Count; - Assert.Throws(() => list.Remove(default)); + Assert.Throws(() => list.Remove(default!)); Assert.Equal(originalCount, list.Count); Assert.Throws(() => list.RemoveAt(0)); Assert.Equal(originalCount, list.Count); @@ -293,27 +293,27 @@ private static void TestIListTInterfaceImpl(IList list, bool supportsNullV if (supportsNullValues) { - Assert.Throws(() => list.Add(default)); - Assert.NotEqual(default, list[list.Count - 1]); - Assert.False(list.Contains(default)); + Assert.Throws(() => list.Add(default!)); + Assert.NotEqual(default!, list[list.Count - 1]); + Assert.False(list.Contains(default!)); Assert.Equal(list.Count - 1, list.IndexOf((T)(object)601)); - Assert.Throws(() => list[list.Count - 1] = default); + Assert.Throws(() => list[list.Count - 1] = default!); Assert.Equal((T)(object)601, list[list.Count - 1]); - Assert.False(list.Contains(default)); - Assert.Equal(-1, list.IndexOf(default)); + Assert.False(list.Contains(default!)); + Assert.Equal(-1, list.IndexOf(default!)); - Assert.Throws(() => list[list.Count - 1] = default); - Assert.NotEqual(default, list[list.Count - 1]); + Assert.Throws(() => list[list.Count - 1] = default!); + Assert.NotEqual(default!, list[list.Count - 1]); } else { // In the face of two errors, verify consistent behavior - Assert.Throws(() => list[list.Count] = default); - Assert.Throws(() => list.Insert(-1, default)); + Assert.Throws(() => list[list.Count] = default!); + Assert.Throws(() => list.Insert(-1, default!)); - Assert.Throws(() => list.Add(default)); - Assert.Throws(() => list[list.Count - 1] = default); + Assert.Throws(() => list.Add(default!)); + Assert.Throws(() => list[list.Count - 1] = default!); Assert.Throws(() => list.Add(Activator.CreateInstance())); Assert.Throws(() => list[list.Count - 1] = Activator.CreateInstance()); Assert.Throws(() => list.Insert(0, Activator.CreateInstance())); @@ -369,50 +369,50 @@ private static void TestICollectionTInterfaceImpl(ICollection collection, var copy = new T[collection.Count]; Assert.Throws(() => collection.CopyTo(copy, -1)); - Assert.All(copy, item => Assert.Equal(default, item)); - Assert.All(copy, item => Assert.Equal(default, item)); + Assert.All(copy, item => Assert.Equal(default!, item)); + Assert.All(copy, item => Assert.Equal(default!, item)); collection.CopyTo(copy, 0); - Assert.Equal(600, copy[0]); - Assert.Equal(601, copy[1]); + Assert.Equal(600, copy[0]); + Assert.Equal(601, copy[1]); copy = new T[collection.Count + 2]; collection.CopyTo(copy, 1); - Assert.Equal(default, copy[0]); - Assert.Equal(600, copy[1]); - Assert.Equal(601, copy[2]); - Assert.Equal(default, copy[3]); + Assert.Equal(default!, copy[0]); + Assert.Equal(600, copy[1]); + Assert.Equal(601, copy[2]); + Assert.Equal(default!, copy[3]); } else { var copy = new T[collection.Count]; Assert.Throws(() => collection.CopyTo(copy, -1)); - Assert.All(copy, item => Assert.Equal(default, item)); - Assert.All(copy, item => Assert.Equal(default, item)); + Assert.All(copy, item => Assert.Equal(default!, item)); + Assert.All(copy, item => Assert.Equal(default!, item)); collection.CopyTo(copy, 0); - Assert.Equal(600, copy[0]); - Assert.Equal(601, copy[1]); + Assert.Equal(600, copy[0]); + Assert.Equal(601, copy[1]); copy = new T[collection.Count + 2]; collection.CopyTo(copy, 1); - Assert.Equal(default, copy[0]); - Assert.Equal(600, copy[1]); - Assert.Equal(601, copy[2]); - Assert.Equal(default, copy[3]); + Assert.Equal(default!, copy[0]); + Assert.Equal(600, copy[1]); + Assert.Equal(601, copy[2]); + Assert.Equal(default!, copy[3]); } Assert.Throws(() => collection.Clear()); - Assert.Throws(() => collection.Add(default)); - Assert.Throws(() => collection.Remove(default)); + Assert.Throws(() => collection.Add(default!)); + Assert.Throws(() => collection.Remove(default!)); } [Fact] public void TestCopyToValidation() { var set = ImmutableSortedTreeSet.CreateRange(Enumerable.Range(0, 10)); - Assert.Throws("array", () => ((ICollection)set).CopyTo(array: null, 0)); + Assert.Throws("array", () => ((ICollection)set).CopyTo(array: null!, 0)); Assert.Throws("arrayIndex", () => ((ICollection)set).CopyTo(new int[set.Count], -1)); Assert.Throws(string.Empty, () => ((ICollection)set).CopyTo(new int[set.Count - 1], 0)); Assert.Throws(() => ((ICollection)set).CopyTo(new int[set.Count], 1)); @@ -486,7 +486,7 @@ public void TestUnion2() var set = ImmutableSortedTreeSet.Create(); CollectionAssert.EnumeratorNotInvalidated(set, () => set = set.Union(expected)); - Assert.Throws("other", () => set.Union(null)); + Assert.Throws("other", () => set.Union(null!)); CollectionAssert.EnumeratorNotInvalidated(set, () => set.Union(Enumerable.Empty())); Assert.Equal(expected.Length, set.Count); @@ -562,7 +562,7 @@ public void TestExcept2() Assert.IsType>(prunedViaInterface); Assert.Equal(referencePruned, prunedViaInterface); - Assert.Throws("other", () => set.Except(other: null)); + Assert.Throws("other", () => set.Except(other: null!)); } [Fact] diff --git a/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableTreeDictionaryBuilderTest.cs b/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableTreeDictionaryBuilderTest.cs index c9a7d2a..ef652e2 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableTreeDictionaryBuilderTest.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableTreeDictionaryBuilderTest.cs @@ -78,7 +78,7 @@ public void TestRemoveRange() dictionary.RemoveRange(itemsToRemove); Assert.Equal(new[] { 1, 3, 5, 7, 9 }.Select(x => new KeyValuePair(x, x)), dictionary); - Assert.Throws("keys", () => dictionary.RemoveRange(null)); + Assert.Throws("keys", () => dictionary.RemoveRange(null!)); } [Fact] @@ -132,7 +132,7 @@ public void TestIDictionaryT() Assert.Equal(Enumerable.Range(0, 9), dictionary.Values); Assert.Throws(() => dictionary.Keys.Add(0)); - Assert.Throws("array", () => dictionary.Keys.CopyTo(null, 0)); + Assert.Throws("array", () => dictionary.Keys.CopyTo(null!, 0)); Assert.Throws("arrayIndex", () => dictionary.Keys.CopyTo(new int[dictionary.Count], -1)); Assert.Throws("arrayIndex", () => dictionary.Keys.CopyTo(new int[dictionary.Count], dictionary.Count + 1)); Assert.Throws(() => dictionary.Keys.CopyTo(new int[dictionary.Count], 1)); @@ -162,7 +162,7 @@ public void TestIDictionaryT() Assert.Equal(0, keyEnumerator.Current); Assert.Throws(() => dictionary.Values.Add(0)); - Assert.Throws("array", () => dictionary.Values.CopyTo(null, 0)); + Assert.Throws("array", () => dictionary.Values.CopyTo(null!, 0)); Assert.Throws("arrayIndex", () => dictionary.Values.CopyTo(new int[dictionary.Count], -1)); Assert.Throws("arrayIndex", () => dictionary.Values.CopyTo(new int[dictionary.Count], dictionary.Count + 1)); Assert.Throws(() => dictionary.Values.CopyTo(new int[dictionary.Count], 1)); @@ -215,7 +215,7 @@ public void TestIDictionary() Assert.False(dictionary.IsReadOnly); Assert.False(dictionary.IsSynchronized); - Assert.Throws("key", () => dictionary.Add(key: null, value: 1)); + Assert.Throws("key", () => dictionary.Add(key: null!, value: 1)); Assert.Throws("value", () => dictionary.Add(key: 1, value: null)); Assert.Throws("key", () => dictionary.Add(key: "string value", value: 0)); Assert.Throws("value", () => dictionary.Add(key: 0, value: "string value")); @@ -228,11 +228,11 @@ public void TestIDictionary() dictionary.Add(10, 11); Assert.Equal(11, dictionary.Count); - Assert.Throws("key", () => dictionary[key: null]); + Assert.Throws("key", () => dictionary[key: null!]); Assert.Null(dictionary["string key"]); Assert.Equal(11, dictionary[10]); - Assert.Throws("key", () => dictionary[key: null] = 12); + Assert.Throws("key", () => dictionary[key: null!] = 12); Assert.Throws("key", () => dictionary["string key"] = 12); Assert.Throws("value", () => dictionary[10] = null); Assert.Throws("value", () => dictionary[10] = "string value"); @@ -247,11 +247,11 @@ public void TestIDictionary() Assert.Equal(entries.Select(i => i.Key), dictionary.Keys.Cast()); Assert.Equal(entries.Select(i => i.Value), dictionary.Values.Cast()); - Assert.Throws(() => dictionary.Contains(null)); + Assert.Throws(() => dictionary.Contains(null!)); Assert.False(dictionary.Contains("string value")); Assert.True(dictionary.Contains(10)); - Assert.Throws(() => dictionary.Remove(null)); + Assert.Throws(() => dictionary.Remove(null!)); Assert.Equal(11, dictionary.Count); dictionary.Remove("string value"); Assert.Equal(11, dictionary.Count); @@ -300,7 +300,7 @@ void TestCollection(ICollection collection, Func indexToExpectedValue Assert.False(collection.IsSynchronized); Assert.Same(dictionary, collection.SyncRoot); - Assert.Throws("array", () => collection.CopyTo(null, 0)); + Assert.Throws("array", () => collection.CopyTo(null!, 0)); Assert.Throws(() => collection.CopyTo(new int[collection.Count, 1], 0)); Assert.Throws(() => collection.CopyTo(Array.CreateInstance(typeof(int), lengths: new[] { collection.Count }, lowerBounds: new[] { 1 }), 0)); Assert.Throws("index", () => collection.CopyTo(new int[collection.Count], -1)); diff --git a/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableTreeDictionaryTest.cs b/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableTreeDictionaryTest.cs index 0b21797..d42f5be 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableTreeDictionaryTest.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableTreeDictionaryTest.cs @@ -133,24 +133,24 @@ public void TestImmutableTreeDictionaryCreateRange() [Fact] public void TestImmutableTreeDictionaryCreateRangeValidation() { - Assert.Throws("items", () => ImmutableTreeDictionary.CreateRange(null)); - Assert.Throws("items", () => ImmutableTreeDictionary.CreateRange(EqualityComparer.Default, null)); - Assert.Throws("items", () => ImmutableTreeDictionary.CreateRange(EqualityComparer.Default, EqualityComparer.Default, null)); - - Assert.Throws("items", () => default(IEnumerable>).ToImmutableTreeDictionary()); - Assert.Throws("items", () => default(IEnumerable>).ToImmutableTreeDictionary(EqualityComparer.Default)); - Assert.Throws("items", () => default(IEnumerable>).ToImmutableTreeDictionary(EqualityComparer.Default, EqualityComparer.Default)); - Assert.Throws("source", () => default(IEnumerable>).ToImmutableTreeDictionary(x => x)); - Assert.Throws("source", () => default(IEnumerable>).ToImmutableTreeDictionary(x => x.Key, EqualityComparer.Default)); - Assert.Throws("source", () => default(IEnumerable>).ToImmutableTreeDictionary(x => x.Key, x => x.Value, EqualityComparer.Default)); - Assert.Throws("source", () => default(IEnumerable>).ToImmutableTreeDictionary(x => x.Key, x => x.Value, EqualityComparer.Default, EqualityComparer.Default)); - - Assert.Throws("keySelector", () => Enumerable.Empty>().ToImmutableTreeDictionary(keySelector: null, EqualityComparer.Default)); - Assert.Throws("keySelector", () => Enumerable.Empty>().ToImmutableTreeDictionary(keySelector: null, x => x.Value, EqualityComparer.Default)); - Assert.Throws("keySelector", () => Enumerable.Empty>().ToImmutableTreeDictionary(keySelector: null, x => x.Value, EqualityComparer.Default, EqualityComparer.Default)); - - Assert.Throws("elementSelector", () => Enumerable.Empty>().ToImmutableTreeDictionary, string, int>(x => x.Key, elementSelector: null, EqualityComparer.Default)); - Assert.Throws("elementSelector", () => Enumerable.Empty>().ToImmutableTreeDictionary(x => x.Key, elementSelector: null, EqualityComparer.Default, EqualityComparer.Default)); + Assert.Throws("items", () => ImmutableTreeDictionary.CreateRange(null!)); + Assert.Throws("items", () => ImmutableTreeDictionary.CreateRange(EqualityComparer.Default, null!)); + Assert.Throws("items", () => ImmutableTreeDictionary.CreateRange(EqualityComparer.Default, EqualityComparer.Default, null!)); + + Assert.Throws("items", () => default(IEnumerable>)!.ToImmutableTreeDictionary()); + Assert.Throws("items", () => default(IEnumerable>)!.ToImmutableTreeDictionary(EqualityComparer.Default)); + Assert.Throws("items", () => default(IEnumerable>)!.ToImmutableTreeDictionary(EqualityComparer.Default, EqualityComparer.Default)); + Assert.Throws("source", () => default(IEnumerable>)!.ToImmutableTreeDictionary(x => x)); + Assert.Throws("source", () => default(IEnumerable>)!.ToImmutableTreeDictionary(x => x.Key, EqualityComparer.Default)); + Assert.Throws("source", () => default(IEnumerable>)!.ToImmutableTreeDictionary(x => x.Key, x => x.Value, EqualityComparer.Default)); + Assert.Throws("source", () => default(IEnumerable>)!.ToImmutableTreeDictionary(x => x.Key, x => x.Value, EqualityComparer.Default, EqualityComparer.Default)); + + Assert.Throws("keySelector", () => Enumerable.Empty>().ToImmutableTreeDictionary(keySelector: null!, EqualityComparer.Default)); + Assert.Throws("keySelector", () => Enumerable.Empty>().ToImmutableTreeDictionary(keySelector: null!, x => x.Value, EqualityComparer.Default)); + Assert.Throws("keySelector", () => Enumerable.Empty>().ToImmutableTreeDictionary(keySelector: null!, x => x.Value, EqualityComparer.Default, EqualityComparer.Default)); + + Assert.Throws("elementSelector", () => Enumerable.Empty>().ToImmutableTreeDictionary, string, int>(x => x.Key, elementSelector: null!, EqualityComparer.Default)); + Assert.Throws("elementSelector", () => Enumerable.Empty>().ToImmutableTreeDictionary(x => x.Key, elementSelector: null!, EqualityComparer.Default, EqualityComparer.Default)); } [Fact] @@ -248,8 +248,8 @@ public void TestExplicitComparer() Assert.Same(EqualityComparer.Default, ImmutableTreeDictionary.Create(keyComparer: null, valueComparer: objComparer).KeyComparer); Assert.Same(objComparer, ImmutableTreeDictionary.Create(keyComparer: null, valueComparer: objComparer).ValueComparer); - Assert.Same(EqualityComparer.Default, ImmutableTreeDictionary.Create().Add(new object(), null).WithComparers(keyComparer: null, valueComparer: objComparer).KeyComparer); - Assert.Same(objComparer, ImmutableTreeDictionary.Create().Add(new object(), null).WithComparers(keyComparer: null, valueComparer: objComparer).ValueComparer); + Assert.Same(EqualityComparer.Default, ImmutableTreeDictionary.Create().Add(new object(), null!).WithComparers(keyComparer: null, valueComparer: objComparer).KeyComparer); + Assert.Same(objComparer, ImmutableTreeDictionary.Create().Add(new object(), null!).WithComparers(keyComparer: null, valueComparer: objComparer).ValueComparer); } [Fact] @@ -282,7 +282,7 @@ public void TestIDictionaryT() Assert.Equal(Enumerable.Range(0, 9), dictionary.Values); Assert.Throws(() => dictionary.Keys.Add(0)); - Assert.Throws("array", () => dictionary.Keys.CopyTo(null, 0)); + Assert.Throws("array", () => dictionary.Keys.CopyTo(null!, 0)); Assert.Throws("arrayIndex", () => dictionary.Keys.CopyTo(new int[dictionary.Count], -1)); Assert.Throws("arrayIndex", () => dictionary.Keys.CopyTo(new int[dictionary.Count], dictionary.Count + 1)); Assert.Throws(() => dictionary.Keys.CopyTo(new int[dictionary.Count], 1)); @@ -300,7 +300,7 @@ public void TestIDictionaryT() Assert.Equal(0, keyEnumerator.Current); Assert.Throws(() => dictionary.Values.Add(0)); - Assert.Throws("array", () => dictionary.Values.CopyTo(null, 0)); + Assert.Throws("array", () => dictionary.Values.CopyTo(null!, 0)); Assert.Throws("arrayIndex", () => dictionary.Values.CopyTo(new int[dictionary.Count], -1)); Assert.Throws("arrayIndex", () => dictionary.Values.CopyTo(new int[dictionary.Count], dictionary.Count + 1)); Assert.Throws(() => dictionary.Values.CopyTo(new int[dictionary.Count], 1)); @@ -354,7 +354,7 @@ public void TestIDictionary() dictionary = Enumerable.Range(0, 11).ToImmutableTreeDictionary(x => x, x => x + 1); - Assert.Throws("key", () => dictionary[key: null]); + Assert.Throws("key", () => dictionary[key: null!]); Assert.Null(dictionary["string key"]); Assert.Equal(11, dictionary[10]); @@ -369,7 +369,7 @@ public void TestIDictionary() Assert.Equal(entries.Select(i => i.Key), dictionary.Keys.Cast()); Assert.Equal(entries.Select(i => i.Value), dictionary.Values.Cast()); - Assert.Throws(() => dictionary.Contains(null)); + Assert.Throws(() => dictionary.Contains(null!)); Assert.False(dictionary.Contains("string value")); Assert.True(dictionary.Contains(10)); @@ -421,7 +421,7 @@ void TestCollection(ICollection collection, Func indexToExpectedValue Assert.True(collection.IsSynchronized); Assert.Same(dictionary, collection.SyncRoot); - Assert.Throws("array", () => collection.CopyTo(null, 0)); + Assert.Throws("array", () => collection.CopyTo(null!, 0)); Assert.Throws(() => collection.CopyTo(new int[collection.Count, 1], 0)); Assert.Throws(() => collection.CopyTo(Array.CreateInstance(typeof(int), lengths: new[] { collection.Count }, lowerBounds: new[] { 1 }), 0)); Assert.Throws("index", () => collection.CopyTo(new int[collection.Count], -1)); diff --git a/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableTreeListBuilderTest+ForEach.cs b/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableTreeListBuilderTest+ForEach.cs index 97b7a31..12582c5 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableTreeListBuilderTest+ForEach.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableTreeListBuilderTest+ForEach.cs @@ -58,15 +58,15 @@ public void NegTest1() { int[] iArray = { 1, 9, 3, 6, -1, 8, 7, 1, 2, 4 }; var listObject = ImmutableTreeList.Create(iArray).ToBuilder(); - Action action = null; - Assert.Throws(() => listObject.ForEach(action)); + Action? action = null; + Assert.Throws(() => listObject.ForEach(action!)); } public class MyClass { public int Sum { get; set; } = 0; - public string Result + public string? Result { get; set; } diff --git a/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableTreeListBuilderTest.cs b/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableTreeListBuilderTest.cs index 534f737..1c94730 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableTreeListBuilderTest.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableTreeListBuilderTest.cs @@ -66,7 +66,7 @@ private static void TestIListInterfaceImpl(IList list, bool supportsNullValues) list.Remove("Text"); Assert.Equal(originalCount, list.Count); - object removedItem = list[0]; + object? removedItem = list[0]; list.Remove(list[0]); Assert.Equal(originalCount - 1, list.Count); Assert.True(list.Contains(removedItem)); @@ -139,7 +139,7 @@ private static void TestICollectionInterfaceImpl(ICollection collection, bool is Assert.Same(collection.SyncRoot, collection.SyncRoot); } - Assert.Throws("array", () => collection.CopyTo(null, 0)); + Assert.Throws("array", () => collection.CopyTo(null!, 0)); Assert.Throws(() => collection.CopyTo(new int[collection.Count, 1], 0)); void CopyToArrayWithNonZeroLowerBound() => collection.CopyTo(Array.CreateInstance(typeof(int), lengths: new[] { collection.Count }, lowerBounds: new[] { 1 }), 0); @@ -222,40 +222,40 @@ private static void TestICollectionTInterfaceImpl(ICollection collection, var copy = new T[collection.Count]; Assert.Throws(() => collection.CopyTo(copy, -1)); - Assert.All(copy, item => Assert.Equal(default, item)); + Assert.All(copy, item => Assert.Equal(default!, item)); Assert.Throws(() => collection.CopyTo(copy, 1)); - Assert.All(copy, item => Assert.Equal(default, item)); + Assert.All(copy, item => Assert.Equal(default!, item)); collection.CopyTo(copy, 0); - Assert.Equal(600, copy[0]); - Assert.Equal(601, copy[1]); + Assert.Equal(600, copy[0]); + Assert.Equal(601, copy[1]); copy = new T[collection.Count + 2]; collection.CopyTo(copy, 1); - Assert.Equal(default, copy[0]); - Assert.Equal(600, copy[1]); - Assert.Equal(601, copy[2]); - Assert.Equal(default, copy[3]); + Assert.Equal(default!, copy[0]); + Assert.Equal(600, copy[1]); + Assert.Equal(601, copy[2]); + Assert.Equal(default!, copy[3]); } else { var copy = new T[collection.Count]; Assert.Throws(() => collection.CopyTo(copy, -1)); - Assert.All(copy, item => Assert.Equal(default, item)); + Assert.All(copy, item => Assert.Equal(default!, item)); Assert.Throws(() => collection.CopyTo(copy, 1)); - Assert.All(copy, item => Assert.Equal(default, item)); + Assert.All(copy, item => Assert.Equal(default!, item)); collection.CopyTo(copy, 0); - Assert.Equal(600, copy[0]); - Assert.Equal(601, copy[1]); + Assert.Equal(600, copy[0]); + Assert.Equal(601, copy[1]); copy = new T[collection.Count + 2]; collection.CopyTo(copy, 1); - Assert.Equal(default, copy[0]); - Assert.Equal(600, copy[1]); - Assert.Equal(601, copy[2]); - Assert.Equal(default, copy[3]); + Assert.Equal(default!, copy[0]); + Assert.Equal(600, copy[1]); + Assert.Equal(601, copy[2]); + Assert.Equal(default!, copy[3]); } } @@ -280,8 +280,8 @@ public void TestIndexer() public void TestCopyToValidation() { ImmutableTreeList.Builder list = ImmutableTreeList.CreateRange(Enumerable.Range(0, 10)).ToBuilder(); - Assert.Throws("array", () => list.CopyTo(null)); - Assert.Throws("array", () => list.CopyTo(0, null, 0, list.Count)); + Assert.Throws("array", () => list.CopyTo(null!)); + Assert.Throws("array", () => list.CopyTo(0, null!, 0, list.Count)); Assert.Throws("index", () => list.CopyTo(-1, new int[list.Count], 0, list.Count)); Assert.Throws("arrayIndex", () => list.CopyTo(0, new int[list.Count], -1, list.Count)); Assert.Throws("count", () => list.CopyTo(0, new int[list.Count], 0, -1)); @@ -341,7 +341,7 @@ public void TestAddRange() ImmutableTreeList.Builder list = ImmutableTreeList.CreateBuilder(); CollectionAssert.EnumeratorInvalidated(list, () => list.AddRange(expected)); - Assert.Throws("collection", () => list.AddRange(null)); + Assert.Throws("collection", () => list.AddRange(null!)); CollectionAssert.EnumeratorNotInvalidated(list, () => list.AddRange(Enumerable.Empty())); Assert.Equal(expected.Length, list.Count); @@ -409,7 +409,7 @@ public void TestInsertRange() ImmutableTreeList.Builder list = ImmutableTreeList.CreateBuilder(); List reference = new List(); - Assert.Throws("collection", () => list.InsertRange(0, null)); + Assert.Throws("collection", () => list.InsertRange(0, null!)); Assert.Throws("index", () => list.InsertRange(-1, Enumerable.Empty())); Assert.Throws(null, () => list.InsertRange(1, Enumerable.Empty())); @@ -589,9 +589,9 @@ public void TestFindIndex() reference.Insert(index, i); } - Assert.Throws(() => list.FindIndex(null)); - Assert.Throws(() => list.FindIndex(0, null)); - Assert.Throws(() => list.FindIndex(0, 0, null)); + Assert.Throws(() => list.FindIndex(null!)); + Assert.Throws(() => list.FindIndex(0, null!)); + Assert.Throws(() => list.FindIndex(0, 0, null!)); Assert.Throws(() => list.FindIndex(-1, i => true)); Assert.Throws(() => list.FindIndex(0, -1, i => true)); @@ -630,9 +630,9 @@ public void TestFindLastIndex() reference.Insert(index, i); } - Assert.Throws(() => list.FindLastIndex(null)); - Assert.Throws(() => list.FindLastIndex(-1, null)); - Assert.Throws(() => list.FindLastIndex(-1, 0, null)); + Assert.Throws(() => list.FindLastIndex(null!)); + Assert.Throws(() => list.FindLastIndex(-1, null!)); + Assert.Throws(() => list.FindLastIndex(-1, 0, null!)); Assert.Throws(() => list.FindLastIndex(list.Count, i => true)); Assert.Throws(() => list.FindLastIndex(list.Count - 1, -1, i => true)); @@ -812,7 +812,7 @@ public void TestSortComparison() reference.Insert(index, item); } - Assert.Throws(() => list.Sort((Comparison)null)); + Assert.Throws(() => list.Sort((Comparison)null!)); Comparison comparison = (x, y) => x - y; list.Sort(comparison); @@ -1071,7 +1071,7 @@ public void TestRemoveValue() public void TestRemoveAll() { var list = ImmutableTreeList.CreateRange(Enumerable.Range(0, 20)).ToBuilder(); - Assert.Throws(() => list.RemoveAll(null)); + Assert.Throws(() => list.RemoveAll(null!)); Assert.Equal(10, list.RemoveAll(i => (i % 2) == 0)); Assert.Equal(new[] { 1, 3, 5, 7, 9, 11, 13, 15, 17, 19 }, list); @@ -1083,7 +1083,7 @@ public void TestRemoveAll() public void TestExists() { var list = ImmutableTreeList.CreateRange(Enumerable.Range(0, 20)).ToBuilder(); - Assert.Throws(() => list.Exists(null)); + Assert.Throws(() => list.Exists(null!)); Assert.False(list.Exists(value => value < 0)); foreach (var i in list) @@ -1098,7 +1098,7 @@ public void TestExists() public void TestFind() { var list = ImmutableTreeList.CreateRange(Enumerable.Range(1, 20)).ToBuilder(); - Assert.Throws(() => list.Find(null)); + Assert.Throws(() => list.Find(null!)); Assert.Equal(0, list.Find(value => value < 0)); foreach (var i in list) @@ -1113,7 +1113,7 @@ public void TestFind() public void TestFindAll() { var list = ImmutableTreeList.CreateRange(Enumerable.Range(0, 20)).ToBuilder(); - Assert.Throws(() => list.FindAll(null)); + Assert.Throws(() => list.FindAll(null!)); ImmutableTreeList found = list.FindAll(i => (i % 2) == 0); @@ -1129,7 +1129,7 @@ public void TestFindLast() { var list = ImmutableTreeList.CreateRange(Enumerable.Range(1, 20)).ToBuilder(); var reference = new List(Enumerable.Range(1, 20)); - Assert.Throws(() => list.FindLast(null)); + Assert.Throws(() => list.FindLast(null!)); Assert.Equal(0, list.FindLast(i => i < 0)); Assert.Equal(0, reference.FindLast(i => i < 0)); @@ -1164,7 +1164,7 @@ public void TestTrueForAll() { var list = ImmutableTreeList.CreateBuilder(); Assert.True(list.TrueForAll(i => false)); - Assert.Throws(() => list.TrueForAll(null)); + Assert.Throws(() => list.TrueForAll(null!)); list.Add(1); Assert.True(list.TrueForAll(i => i > 0)); diff --git a/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableTreeListTest+ForEach.cs b/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableTreeListTest+ForEach.cs index 629701f..48f2bab 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableTreeListTest+ForEach.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableTreeListTest+ForEach.cs @@ -58,15 +58,15 @@ public void NegTest1() { int[] iArray = { 1, 9, 3, 6, -1, 8, 7, 1, 2, 4 }; var listObject = ImmutableTreeList.Create(iArray); - Action action = null; - Assert.Throws(() => listObject.ForEach(action)); + Action? action = null; + Assert.Throws(() => listObject.ForEach(action!)); } public class MyClass { public int Sum { get; set; } = 0; - public string Result + public string? Result { get; set; } diff --git a/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableTreeListTest.cs b/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableTreeListTest.cs index 74e9ad4..b6a841d 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableTreeListTest.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableTreeListTest.cs @@ -60,7 +60,7 @@ private static void TestIListInterfaceImpl(IList list, bool supportsNullValues) Assert.Throws(() => list.Remove("Text")); Assert.Equal(originalCount, list.Count); - object removedItem = list[0]; + object? removedItem = list[0]; Assert.Throws(() => list.Remove(list[0])); Assert.Equal(originalCount, list.Count); Assert.True(list.Contains(removedItem)); @@ -115,29 +115,29 @@ private static void TestIListTInterfaceImpl(IList list, bool supportsNullV { Assert.True(list.IsReadOnly); - Assert.Equal(600, list[0]); - Assert.Equal(601, list[1]); + Assert.Equal(600, list[0]); + Assert.Equal(601, list[1]); Assert.True(list.Contains((T)(object)600)); - Assert.False(list.Contains(default)); + Assert.False(list.Contains(default!)); Assert.Equal(0, list.IndexOf((T)(object)600)); Assert.Equal(1, list.IndexOf((T)(object)601)); - Assert.Equal(-1, list.IndexOf(default)); + Assert.Equal(-1, list.IndexOf(default!)); Assert.Throws(() => list[-1]); - Assert.Throws(() => list[-1] = default); + Assert.Throws(() => list[-1] = default!); Assert.Throws(() => list[list.Count]); - Assert.Throws(() => list[list.Count] = default); - Assert.Throws(() => list.Insert(-1, default)); - Assert.Throws(() => list.Insert(list.Count + 1, default)); + Assert.Throws(() => list[list.Count] = default!); + Assert.Throws(() => list.Insert(-1, default!)); + Assert.Throws(() => list.Insert(list.Count + 1, default!)); Assert.NotEqual(list[1], list[0]); Assert.Throws(() => list.Insert(0, list[0])); Assert.NotEqual(list[1], list[0]); int originalCount = list.Count; - Assert.Throws(() => list.Remove(default)); + Assert.Throws(() => list.Remove(default!)); Assert.Equal(originalCount, list.Count); Assert.Throws(() => list.RemoveAt(0)); Assert.Equal(originalCount, list.Count); @@ -149,27 +149,27 @@ private static void TestIListTInterfaceImpl(IList list, bool supportsNullV if (supportsNullValues) { - Assert.Throws(() => list.Add(default)); - Assert.NotEqual(default, list[list.Count - 1]); - Assert.False(list.Contains(default)); + Assert.Throws(() => list.Add(default!)); + Assert.NotEqual(default!, list[list.Count - 1]); + Assert.False(list.Contains(default!)); Assert.Equal(list.Count - 1, list.IndexOf((T)(object)601)); - Assert.Throws(() => list[list.Count - 1] = default); + Assert.Throws(() => list[list.Count - 1] = default!); Assert.Equal((T)(object)601, list[list.Count - 1]); - Assert.False(list.Contains(default)); - Assert.Equal(-1, list.IndexOf(default)); + Assert.False(list.Contains(default!)); + Assert.Equal(-1, list.IndexOf(default!)); - Assert.Throws(() => list[list.Count - 1] = default); - Assert.NotEqual(default, list[list.Count - 1]); + Assert.Throws(() => list[list.Count - 1] = default!); + Assert.NotEqual(default!, list[list.Count - 1]); } else { // In the face of two errors, verify consistent behavior - Assert.Throws(() => list[list.Count] = default); - Assert.Throws(() => list.Insert(-1, default)); + Assert.Throws(() => list[list.Count] = default!); + Assert.Throws(() => list.Insert(-1, default!)); - Assert.Throws(() => list.Add(default)); - Assert.Throws(() => list[list.Count - 1] = default); + Assert.Throws(() => list.Add(default!)); + Assert.Throws(() => list[list.Count - 1] = default!); Assert.Throws(() => list.Add(Activator.CreateInstance())); Assert.Throws(() => list[list.Count - 1] = Activator.CreateInstance()); Assert.Throws(() => list.Insert(0, Activator.CreateInstance())); @@ -208,7 +208,7 @@ private static void TestICollectionInterfaceImpl(ICollection collection, bool su Assert.NotNull(collection.SyncRoot); Assert.Same(collection, collection.SyncRoot); - Assert.Throws("array", () => collection.CopyTo(null, 0)); + Assert.Throws("array", () => collection.CopyTo(null!, 0)); Assert.Throws(() => collection.CopyTo(new int[collection.Count, 1], 0)); void CopyToArrayWithNonZeroLowerBound() => collection.CopyTo(Array.CreateInstance(typeof(int), lengths: new[] { collection.Count }, lowerBounds: new[] { 1 }), 0); @@ -291,45 +291,45 @@ private static void TestICollectionTInterfaceImpl(ICollection collection, var copy = new T[collection.Count]; Assert.Throws(() => collection.CopyTo(copy, -1)); - Assert.All(copy, item => Assert.Equal(default, item)); + Assert.All(copy, item => Assert.Equal(default!, item)); Assert.Throws(() => collection.CopyTo(copy, 1)); - Assert.All(copy, item => Assert.Equal(default, item)); + Assert.All(copy, item => Assert.Equal(default!, item)); collection.CopyTo(copy, 0); - Assert.Equal(600, copy[0]); - Assert.Equal(601, copy[1]); + Assert.Equal(600, copy[0]); + Assert.Equal(601, copy[1]); copy = new T[collection.Count + 2]; collection.CopyTo(copy, 1); - Assert.Equal(default, copy[0]); - Assert.Equal(600, copy[1]); - Assert.Equal(601, copy[2]); - Assert.Equal(default, copy[3]); + Assert.Equal(default!, copy[0]); + Assert.Equal(600, copy[1]); + Assert.Equal(601, copy[2]); + Assert.Equal(default!, copy[3]); } else { var copy = new T[collection.Count]; Assert.Throws(() => collection.CopyTo(copy, -1)); - Assert.All(copy, item => Assert.Equal(default, item)); + Assert.All(copy, item => Assert.Equal(default!, item)); Assert.Throws(() => collection.CopyTo(copy, 1)); - Assert.All(copy, item => Assert.Equal(default, item)); + Assert.All(copy, item => Assert.Equal(default!, item)); collection.CopyTo(copy, 0); - Assert.Equal(600, copy[0]); - Assert.Equal(601, copy[1]); + Assert.Equal(600, copy[0]); + Assert.Equal(601, copy[1]); copy = new T[collection.Count + 2]; collection.CopyTo(copy, 1); - Assert.Equal(default, copy[0]); - Assert.Equal(600, copy[1]); - Assert.Equal(601, copy[2]); - Assert.Equal(default, copy[3]); + Assert.Equal(default!, copy[0]); + Assert.Equal(600, copy[1]); + Assert.Equal(601, copy[2]); + Assert.Equal(default!, copy[3]); } Assert.Throws(() => collection.Clear()); - Assert.Throws(() => collection.Add(default)); - Assert.Throws(() => collection.Remove(default)); + Assert.Throws(() => collection.Add(default!)); + Assert.Throws(() => collection.Remove(default!)); } [Fact] @@ -362,8 +362,8 @@ public void TestIndexer() public void TestCopyToValidation() { ImmutableTreeList list = ImmutableTreeList.CreateRange(Enumerable.Range(0, 10)); - Assert.Throws("array", () => list.CopyTo(null)); - Assert.Throws("array", () => list.CopyTo(0, null, 0, list.Count)); + Assert.Throws("array", () => list.CopyTo(null!)); + Assert.Throws("array", () => list.CopyTo(0, null!, 0, list.Count)); Assert.Throws("index", () => list.CopyTo(-1, new int[list.Count], 0, list.Count)); Assert.Throws("arrayIndex", () => list.CopyTo(0, new int[list.Count], -1, list.Count)); Assert.Throws("count", () => list.CopyTo(0, new int[list.Count], 0, -1)); @@ -438,7 +438,7 @@ public void TestAddRange() ImmutableTreeList list = ImmutableTreeList.Create(); CollectionAssert.EnumeratorNotInvalidated(list, () => list = list.AddRange(expected)); - Assert.Throws("collection", () => list.AddRange(null)); + Assert.Throws("collection", () => list.AddRange(null!)); CollectionAssert.EnumeratorNotInvalidated(list, () => list.AddRange(Enumerable.Empty())); Assert.Equal(expected.Length, list.Count); @@ -548,7 +548,7 @@ public void TestInsertRange() ImmutableTreeList list = ImmutableTreeList.Create(); List reference = new List(); - Assert.Throws("collection", () => list.InsertRange(0, null)); + Assert.Throws("collection", () => list.InsertRange(0, null!)); Assert.Throws("index", () => list.InsertRange(-1, Enumerable.Empty())); Assert.Throws(null, () => list.InsertRange(1, Enumerable.Empty())); @@ -766,9 +766,9 @@ public void TestFindIndex() reference.Insert(index, i); } - Assert.Throws(() => list.FindIndex(null)); - Assert.Throws(() => list.FindIndex(0, null)); - Assert.Throws(() => list.FindIndex(0, 0, null)); + Assert.Throws(() => list.FindIndex(null!)); + Assert.Throws(() => list.FindIndex(0, null!)); + Assert.Throws(() => list.FindIndex(0, 0, null!)); Assert.Throws(() => list.FindIndex(-1, i => true)); Assert.Throws(() => list.FindIndex(0, -1, i => true)); @@ -807,9 +807,9 @@ public void TestFindLastIndex() reference.Insert(index, i); } - Assert.Throws(() => list.FindLastIndex(null)); - Assert.Throws(() => list.FindLastIndex(-1, null)); - Assert.Throws(() => list.FindLastIndex(-1, 0, null)); + Assert.Throws(() => list.FindLastIndex(null!)); + Assert.Throws(() => list.FindLastIndex(-1, null!)); + Assert.Throws(() => list.FindLastIndex(-1, 0, null!)); Assert.Throws(() => list.FindLastIndex(list.Count, i => true)); Assert.Throws(() => list.FindLastIndex(list.Count - 1, -1, i => true)); @@ -995,7 +995,7 @@ public void TestSortComparison() reference.Insert(index, item); } - Assert.Throws(() => list.Sort((Comparison)null)); + Assert.Throws(() => list.Sort((Comparison)null!)); Comparison comparison = (x, y) => x - y; list = list.Sort(comparison); @@ -1075,7 +1075,7 @@ public void TestRemoveRangeItems() Assert.IsType>(prunedViaInterface); Assert.Equal(referencePruned, prunedViaInterface); - Assert.Throws("items", () => list.RemoveRange(items: null)); + Assert.Throws("items", () => list.RemoveRange(items: null!)); } [Fact] @@ -1363,7 +1363,7 @@ private void TestReplaceValueImpl(IImmutableList list) public void TestRemoveAll() { var list = ImmutableTreeList.CreateRange(Enumerable.Range(0, 20)); - Assert.Throws(() => list.RemoveAll(null)); + Assert.Throws(() => list.RemoveAll(null!)); Assert.Equal(10, list.Count - list.RemoveAll(i => (i % 2) == 0).Count); Assert.Equal(Enumerable.Range(0, 20), list); @@ -1381,7 +1381,7 @@ public void TestRemoveAll() public void TestExists() { var list = ImmutableTreeList.CreateRange(Enumerable.Range(0, 20)); - Assert.Throws(() => list.Exists(null)); + Assert.Throws(() => list.Exists(null!)); Assert.False(list.Exists(value => value < 0)); foreach (var i in list) @@ -1396,7 +1396,7 @@ public void TestExists() public void TestFind() { var list = ImmutableTreeList.CreateRange(Enumerable.Range(1, 20)); - Assert.Throws(() => list.Find(null)); + Assert.Throws(() => list.Find(null!)); Assert.Equal(0, list.Find(value => value < 0)); foreach (var i in list) @@ -1411,7 +1411,7 @@ public void TestFind() public void TestFindAll() { var list = ImmutableTreeList.CreateRange(Enumerable.Range(0, 20)); - Assert.Throws(() => list.FindAll(null)); + Assert.Throws(() => list.FindAll(null!)); ImmutableTreeList found = list.FindAll(i => (i % 2) == 0); @@ -1427,7 +1427,7 @@ public void TestFindLast() { var list = ImmutableTreeList.CreateRange(Enumerable.Range(1, 20)); var reference = new List(Enumerable.Range(1, 20)); - Assert.Throws(() => list.FindLast(null)); + Assert.Throws(() => list.FindLast(null!)); Assert.Equal(0, list.FindLast(i => i < 0)); Assert.Equal(0, reference.FindLast(i => i < 0)); @@ -1444,7 +1444,7 @@ public void TestTrueForAll() { var list = ImmutableTreeList.Create(); Assert.True(list.TrueForAll(i => false)); - Assert.Throws(() => list.TrueForAll(null)); + Assert.Throws(() => list.TrueForAll(null!)); list = list.Add(1); Assert.True(list.TrueForAll(i => i > 0)); diff --git a/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableTreeQueueTest.cs b/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableTreeQueueTest.cs index 324efe5..e675c88 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableTreeQueueTest.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableTreeQueueTest.cs @@ -39,7 +39,7 @@ public void TestMultipleElementQueue() [Fact] public void TestImmutableTreeQueueCreateValidation() { - Assert.Throws("items", () => ImmutableTreeQueue.Create(null)); + Assert.Throws("items", () => ImmutableTreeQueue.Create(null!)); } [Fact] @@ -53,7 +53,7 @@ public void TestImmutableTreeQueueCreateRange() [Fact] public void TestImmutableTreeQueueCreateRangeValidation() { - Assert.Throws("items", () => ImmutableTreeQueue.CreateRange(null)); + Assert.Throws("items", () => ImmutableTreeQueue.CreateRange(null!)); } [Fact] diff --git a/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableTreeSetBuilderTest+CollidingHashCodes.cs b/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableTreeSetBuilderTest+CollidingHashCodes.cs index 4a39c90..78d72be 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableTreeSetBuilderTest+CollidingHashCodes.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableTreeSetBuilderTest+CollidingHashCodes.cs @@ -20,11 +20,11 @@ public class CollidingHashCodes : AbstractSetTest [Fact] public void TestTryGetValueWithCollidingHashCodes() { - ImmutableTreeSet.Builder set = ImmutableTreeSet.CreateBuilder(new ZeroHashCodeEqualityComparer(StringComparer.OrdinalIgnoreCase)); + ImmutableTreeSet.Builder set = ImmutableTreeSet.CreateBuilder(new ZeroHashCodeEqualityComparer(StringComparer.OrdinalIgnoreCase)); Assert.True(set.Add("a")); Assert.False(set.Add("A")); - Assert.True(set.TryGetValue("a", out string value)); + Assert.True(set.TryGetValue("a", out string? value)); Assert.Equal("a", value); Assert.True(set.TryGetValue("A", out value)); @@ -35,7 +35,7 @@ public void TestTryGetValueWithCollidingHashCodes() // The test below forces coverage of an edge case. We don't know if the hash code for 'aa' or 'bb' comes // first, so write the test in a way that either will cover the early-exit branch in TryGetValue. - set = ImmutableTreeSet.CreateBuilder(new SubsetHashCodeEqualityComparer(StringComparer.Ordinal, StringComparer.OrdinalIgnoreCase)); + set = ImmutableTreeSet.CreateBuilder(new SubsetHashCodeEqualityComparer(StringComparer.Ordinal, StringComparer.OrdinalIgnoreCase)); Assert.True(set.Add("aa")); Assert.True(set.Add("Aa")); Assert.True(set.Add("bb")); diff --git a/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableTreeSetBuilderTest.cs b/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableTreeSetBuilderTest.cs index 9a7eac4..775c25e 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableTreeSetBuilderTest.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableTreeSetBuilderTest.cs @@ -28,7 +28,7 @@ public void TestCollectionConstructorUsesCorrectComparer() Assert.Equal(2, objectSet.Count); Assert.Equal(new[] { instance1, instance2 }, objectSet); - ImmutableTreeSet.Builder stringSet = ImmutableTreeSet.CreateBuilder(); + ImmutableTreeSet.Builder stringSet = ImmutableTreeSet.CreateBuilder(); Assert.Same(EqualityComparer.Default, stringSet.KeyComparer); stringSet = ImmutableTreeSet.CreateBuilder(StringComparer.OrdinalIgnoreCase); @@ -106,7 +106,7 @@ public void TestICollectionInterface() public void TestCopyToValidation() { var set = ImmutableTreeSet.CreateRange(Enumerable.Range(0, 10)).ToBuilder(); - Assert.Throws("array", () => ((ICollection)set).CopyTo(array: null, 0)); + Assert.Throws("array", () => ((ICollection)set).CopyTo(array: null!, 0)); Assert.Throws("arrayIndex", () => ((ICollection)set).CopyTo(new int[set.Count], -1)); Assert.Throws(string.Empty, () => ((ICollection)set).CopyTo(new int[set.Count - 1], 0)); Assert.Throws(() => ((ICollection)set).CopyTo(new int[set.Count], 1)); @@ -263,11 +263,11 @@ public void TestTrimExcess() [Fact] public void TestTryGetValue() { - ImmutableTreeSet.Builder set = ImmutableTreeSet.CreateBuilder(StringComparer.OrdinalIgnoreCase); + ImmutableTreeSet.Builder set = ImmutableTreeSet.CreateBuilder(StringComparer.OrdinalIgnoreCase); Assert.True(set.Add("a")); Assert.False(set.Add("A")); - Assert.True(set.TryGetValue("a", out string value)); + Assert.True(set.TryGetValue("a", out string? value)); Assert.Equal("a", value); Assert.True(set.TryGetValue("A", out value)); diff --git a/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableTreeSetTest.cs b/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableTreeSetTest.cs index fc115a1..7bac16e 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableTreeSetTest.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableTreeSetTest.cs @@ -71,8 +71,8 @@ public void TestMultipleElementSet() [Fact] public void TestImmutableTreeSetCreateValidation() { - Assert.Throws("other", () => ImmutableTreeSet.Create(default(int[]))); - Assert.Throws("other", () => ImmutableTreeSet.Create(EqualityComparer.Default, default(int[]))); + Assert.Throws("other", () => ImmutableTreeSet.Create(default(int[])!)); + Assert.Throws("other", () => ImmutableTreeSet.Create(EqualityComparer.Default, default(int[])!)); } [Fact] @@ -86,10 +86,10 @@ public void TestImmutableTreeSetCreateRange() [Fact] public void TestImmutableTreeSetCreateRangeValidation() { - Assert.Throws("other", () => ImmutableTreeSet.CreateRange(null)); - Assert.Throws("other", () => ImmutableTreeSet.CreateRange(EqualityComparer.Default, null)); - Assert.Throws("source", () => default(IEnumerable).ToImmutableTreeSet()); - Assert.Throws("source", () => default(IEnumerable).ToImmutableTreeSet(EqualityComparer.Default)); + Assert.Throws("other", () => ImmutableTreeSet.CreateRange(null!)); + Assert.Throws("other", () => ImmutableTreeSet.CreateRange(EqualityComparer.Default, null!)); + Assert.Throws("source", () => default(IEnumerable)!.ToImmutableTreeSet()); + Assert.Throws("source", () => default(IEnumerable)!.ToImmutableTreeSet(EqualityComparer.Default)); } [Fact] @@ -204,50 +204,50 @@ private static void TestICollectionTInterfaceImpl(ICollection collection, var copy = new T[collection.Count]; Assert.Throws(() => collection.CopyTo(copy, -1)); - Assert.All(copy, item => Assert.Equal(default, item)); - Assert.All(copy, item => Assert.Equal(default, item)); + Assert.All(copy, item => Assert.Equal(default!, item)); + Assert.All(copy, item => Assert.Equal(default!, item)); collection.CopyTo(copy, 0); - Assert.Equal(600, copy[0]); - Assert.Equal(601, copy[1]); + Assert.Equal(600, copy[0]); + Assert.Equal(601, copy[1]); copy = new T[collection.Count + 2]; collection.CopyTo(copy, 1); - Assert.Equal(default, copy[0]); - Assert.Equal(600, copy[1]); - Assert.Equal(601, copy[2]); - Assert.Equal(default, copy[3]); + Assert.Equal(default!, copy[0]); + Assert.Equal(600, copy[1]); + Assert.Equal(601, copy[2]); + Assert.Equal(default!, copy[3]); } else { var copy = new T[collection.Count]; Assert.Throws(() => collection.CopyTo(copy, -1)); - Assert.All(copy, item => Assert.Equal(default, item)); - Assert.All(copy, item => Assert.Equal(default, item)); + Assert.All(copy, item => Assert.Equal(default!, item)); + Assert.All(copy, item => Assert.Equal(default!, item)); collection.CopyTo(copy, 0); - Assert.Equal(600, copy[0]); - Assert.Equal(601, copy[1]); + Assert.Equal(600, copy[0]); + Assert.Equal(601, copy[1]); copy = new T[collection.Count + 2]; collection.CopyTo(copy, 1); - Assert.Equal(default, copy[0]); - Assert.Equal(600, copy[1]); - Assert.Equal(601, copy[2]); - Assert.Equal(default, copy[3]); + Assert.Equal(default!, copy[0]); + Assert.Equal(600, copy[1]); + Assert.Equal(601, copy[2]); + Assert.Equal(default!, copy[3]); } Assert.Throws(() => collection.Clear()); - Assert.Throws(() => collection.Add(default)); - Assert.Throws(() => collection.Remove(default)); + Assert.Throws(() => collection.Add(default!)); + Assert.Throws(() => collection.Remove(default!)); } [Fact] public void TestCopyToValidation() { var set = ImmutableTreeSet.CreateRange(Enumerable.Range(0, 10)); - Assert.Throws("array", () => ((ICollection)set).CopyTo(array: null, 0)); + Assert.Throws("array", () => ((ICollection)set).CopyTo(array: null!, 0)); Assert.Throws("arrayIndex", () => ((ICollection)set).CopyTo(new int[set.Count], -1)); Assert.Throws(string.Empty, () => ((ICollection)set).CopyTo(new int[set.Count - 1], 0)); Assert.Throws(() => ((ICollection)set).CopyTo(new int[set.Count], 1)); @@ -321,7 +321,7 @@ public void TestUnion2() var set = ImmutableTreeSet.Create(); CollectionAssert.EnumeratorNotInvalidated(set, () => set = set.Union(expected)); - Assert.Throws("other", () => set.Union(null)); + Assert.Throws("other", () => set.Union(null!)); CollectionAssert.EnumeratorNotInvalidated(set, () => set.Union(Enumerable.Empty())); Assert.Equal(expected.Length, set.Count); @@ -397,7 +397,7 @@ public void TestExcept2() Assert.IsType>(prunedViaInterface); Assert.Equal(referencePruned, prunedViaInterface); - Assert.Throws("other", () => set.Except(other: null)); + Assert.Throws("other", () => set.Except(other: null!)); } [Fact] diff --git a/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableTreeStackTest.cs b/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableTreeStackTest.cs index 9e05ea3..f13a6e6 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableTreeStackTest.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/Immutable/ImmutableTreeStackTest.cs @@ -39,7 +39,7 @@ public void TestMultipleElementStack() [Fact] public void TestImmutableTreeStackCreateValidation() { - Assert.Throws("items", () => ImmutableTreeStack.Create(null)); + Assert.Throws("items", () => ImmutableTreeStack.Create(null!)); } [Fact] @@ -53,7 +53,7 @@ public void TestImmutableTreeStackCreateRange() [Fact] public void TestImmutableTreeStackCreateRangeValidation() { - Assert.Throws("items", () => ImmutableTreeStack.CreateRange(null)); + Assert.Throws("items", () => ImmutableTreeStack.CreateRange(null!)); } [Fact] diff --git a/TunnelVisionLabs.Collections.Trees.Test/List/BinarySearch1.cs b/TunnelVisionLabs.Collections.Trees.Test/List/BinarySearch1.cs index e253d3e..29dcde1 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/List/BinarySearch1.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/List/BinarySearch1.cs @@ -51,11 +51,21 @@ public void PosTest4() Assert.Equal(1, listObject.BinarySearch(new MyClass(20))); } + [Fact] + public void TestComparable() + { + MyClass first = new MyClass(10); + MyClass second = new MyClass(20); + Assert.Equal(-1, first.CompareTo(second)); + Assert.Equal(1, second.CompareTo(first)); + Assert.Equal(1, first.CompareTo(null)); + } + [Fact(DisplayName = "PosTest5: The item to be search is a null reference")] public void PosTest5() { string[] strArray = { "apple", "banana", "chocolate", "dog", "food" }; - TreeList listObject = new TreeList(strArray); + TreeList listObject = new TreeList(strArray); Assert.Equal(-1, listObject.BinarySearch(null)); } @@ -76,8 +86,11 @@ public MyClass(int a) _value = a; } - public int CompareTo(object obj) + public int CompareTo(object? obj) { + if (obj is null) + return 1; + return _value.CompareTo(((MyClass)obj)._value); } } diff --git a/TunnelVisionLabs.Collections.Trees.Test/List/BinarySearch2.cs b/TunnelVisionLabs.Collections.Trees.Test/List/BinarySearch2.cs index 67ef26a..9d18c57 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/List/BinarySearch2.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/List/BinarySearch2.cs @@ -49,18 +49,29 @@ public void PosTest4() MyClass myclass1 = new MyClass(10); MyClass myclass2 = new MyClass(20); MyClass myclass3 = new MyClass(30); - MyClass[] mc = new MyClass[3] { myclass1, myclass2, myclass3 }; - TreeList listObject = new TreeList(mc); + MyClass?[] mc = new MyClass?[4] { myclass1, null, myclass2, myclass3 }; + TreeList listObject = new TreeList(mc); MyClassIC myclassIC = new MyClassIC(); listObject.Sort(myclassIC); - Assert.Equal(2, listObject.BinarySearch(new MyClass(10), myclassIC)); + Assert.Equal(3, listObject.BinarySearch(new MyClass(10), myclassIC)); + Assert.Equal(0, listObject.BinarySearch(null, myclassIC)); + } + + [Fact] + public void TestComparable() + { + MyClass first = new MyClass(10); + MyClass second = new MyClass(20); + Assert.Equal(-1, first.CompareTo(second)); + Assert.Equal(1, second.CompareTo(first)); + Assert.Equal(1, first.CompareTo(null)); } [Fact(DisplayName = "PosTest5: The item to be search is a null reference")] public void PosTest5() { string[] strArray = { "apple", "banana", "chocolate", "dog", "food" }; - TreeList listObject = new TreeList(strArray); + TreeList listObject = new TreeList(strArray); listObject.Sort(); StrClass strClass = new StrClass(); Assert.Equal(-1, listObject.BinarySearch(null, strClass)); @@ -70,8 +81,8 @@ public void PosTest5() [Fact] public void PosTest5Ext() { - string[] strArray = { null, "banana", "chocolate", "dog", "food" }; - TreeList listObject = new TreeList(strArray); + string?[] strArray = { null, "banana", "chocolate", "dog", "food" }; + TreeList listObject = new TreeList(strArray); listObject.Sort(); StrClass strClass = new StrClass(); Assert.Equal(~1, listObject.BinarySearch(string.Empty, strClass)); @@ -110,8 +121,11 @@ public MyClass(int a) public int Value => _value; - public int CompareTo(object obj) + public int CompareTo(object? obj) { + if (obj is null) + return 1; + return _value.CompareTo(((MyClass)obj)._value); } } @@ -128,9 +142,9 @@ public int Compare(int x, int y) } } - public class StrClass : IComparer + public class StrClass : IComparer { - public int Compare(string x, string y) + public int Compare(string? x, string? y) { { if (x == null) @@ -180,10 +194,19 @@ public int Compare(string x, string y) } } - public class MyClassIC : IComparer + public class MyClassIC : IComparer { - public int Compare(MyClass x, MyClass y) + public int Compare(MyClass? x, MyClass? y) { + if (x is null) + { + return y is null ? 0 : -1; + } + else if (y is null) + { + return 1; + } + return (-1) * x.Value.CompareTo(y.Value); } } diff --git a/TunnelVisionLabs.Collections.Trees.Test/List/BinarySearch3.cs b/TunnelVisionLabs.Collections.Trees.Test/List/BinarySearch3.cs index 78cf848..7c0035d 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/List/BinarySearch3.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/List/BinarySearch3.cs @@ -49,18 +49,29 @@ public void PosTest4() MyClass myclass1 = new MyClass(10); MyClass myclass2 = new MyClass(20); MyClass myclass3 = new MyClass(30); - MyClass[] mc = new MyClass[3] { myclass1, myclass2, myclass3 }; - TreeList listObject = new TreeList(mc); + MyClass?[] mc = new MyClass?[4] { myclass1, null, myclass2, myclass3 }; + TreeList listObject = new TreeList(mc); MyClassIC myclassIC = new MyClassIC(); listObject.Sort(myclassIC); - Assert.Equal(2, listObject.BinarySearch(0, 3, new MyClass(10), myclassIC)); + Assert.Equal(3, listObject.BinarySearch(0, 4, new MyClass(10), myclassIC)); + Assert.Equal(0, listObject.BinarySearch(0, 4, null, myclassIC)); + } + + [Fact] + public void TestComparable() + { + MyClass first = new MyClass(10); + MyClass second = new MyClass(20); + Assert.Equal(-1, first.CompareTo(second)); + Assert.Equal(1, second.CompareTo(first)); + Assert.Equal(1, first.CompareTo(null)); } [Fact(DisplayName = "PosTest5: The item to be search is a null reference")] public void PosTest5() { - string[] strArray = { "apple", "banana", "chocolate", "dog", "food" }; - TreeList listObject = new TreeList(strArray); + string?[] strArray = { "apple", "banana", "chocolate", "dog", "food" }; + TreeList listObject = new TreeList(strArray); listObject.Sort(); StrClass strClass = new StrClass(); Assert.Equal(-1, listObject.BinarySearch(0, 3, null, strClass)); @@ -70,8 +81,8 @@ public void PosTest5() [Fact] public void PosTest5Ext() { - string[] strArray = { null, "banana", "chocolate", "dog", "food" }; - TreeList listObject = new TreeList(strArray); + string?[] strArray = { null, "banana", "chocolate", "dog", "food" }; + TreeList listObject = new TreeList(strArray); listObject.Sort(); StrClass strClass = new StrClass(); Assert.Equal(~1, listObject.BinarySearch(0, 3, string.Empty, strClass)); @@ -143,8 +154,11 @@ public MyClass(int a) public int Value => _value; - public int CompareTo(object obj) + public int CompareTo(object? obj) { + if (obj is null) + return 1; + return _value.CompareTo(((MyClass)obj)._value); } } @@ -161,9 +175,9 @@ public int Compare(int x, int y) } } - public class StrClass : IComparer + public class StrClass : IComparer { - public int Compare(string x, string y) + public int Compare(string? x, string? y) { { if (x == null) @@ -213,10 +227,19 @@ public int Compare(string x, string y) } } - public class MyClassIC : IComparer + public class MyClassIC : IComparer { - public int Compare(MyClass x, MyClass y) + public int Compare(MyClass? x, MyClass? y) { + if (x is null) + { + return y is null ? 0 : -1; + } + else if (y is null) + { + return 1; + } + return (-1) * x.Value.CompareTo(y.Value); } } diff --git a/TunnelVisionLabs.Collections.Trees.Test/List/CopyTo1.cs b/TunnelVisionLabs.Collections.Trees.Test/List/CopyTo1.cs index a911629..bf37776 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/List/CopyTo1.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/List/CopyTo1.cs @@ -60,7 +60,7 @@ public void NegTest1() { int[] iArray = { 1, 9, 3, 6, 5, 8, 7, 2, 4, 0 }; TreeList listObject = new TreeList(iArray); - Assert.Throws(() => listObject.CopyTo(null)); + Assert.Throws(() => listObject.CopyTo(null!)); } [Fact(DisplayName = "NegTest2: The number of elements in the source List is greater than the number of elements that the destination array can contain")] diff --git a/TunnelVisionLabs.Collections.Trees.Test/List/CopyTo2.cs b/TunnelVisionLabs.Collections.Trees.Test/List/CopyTo2.cs index b78afff..0be2124 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/List/CopyTo2.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/List/CopyTo2.cs @@ -73,7 +73,7 @@ public void NegTest1() { int[] iArray = { 1, 9, 3, 6, 5, 8, 7, 2, 4, 0 }; TreeList listObject = new TreeList(iArray); - Assert.Throws(() => listObject.CopyTo(null, 0)); + Assert.Throws(() => listObject.CopyTo(null!, 0)); } [Fact(DisplayName = "NegTest2: The number of elements in the source List is greater than the number of elements that the destination array can contain")] diff --git a/TunnelVisionLabs.Collections.Trees.Test/List/CopyTo3.cs b/TunnelVisionLabs.Collections.Trees.Test/List/CopyTo3.cs index 5bbfe84..c209137 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/List/CopyTo3.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/List/CopyTo3.cs @@ -71,7 +71,7 @@ public void NegTest1() { int[] iArray = { 1, 9, 3, 6, 5, 8, 7, 2, 4, 0 }; TreeList listObject = new TreeList(iArray); - Assert.Throws(() => listObject.CopyTo(0, null, 0, 10)); + Assert.Throws(() => listObject.CopyTo(0, null!, 0, 10)); } [Fact(DisplayName = "NegTest2: The number of elements in the source List is greater than the number of elements that the destination array can contain")] diff --git a/TunnelVisionLabs.Collections.Trees.Test/List/TreeListAdd.cs b/TunnelVisionLabs.Collections.Trees.Test/List/TreeListAdd.cs index a00462a..ea933cc 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/List/TreeListAdd.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/List/TreeListAdd.cs @@ -52,7 +52,7 @@ public void PosTest3() [Fact(DisplayName = "PosTest4: Add null object to the list")] public void PosTest4() { - TreeList listObject = new TreeList(); + TreeList listObject = new TreeList(); listObject.Add(null); Assert.Null(listObject[0]); } diff --git a/TunnelVisionLabs.Collections.Trees.Test/List/TreeListAddRange.cs b/TunnelVisionLabs.Collections.Trees.Test/List/TreeListAddRange.cs index 5d585bc..b716812 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/List/TreeListAddRange.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/List/TreeListAddRange.cs @@ -55,9 +55,9 @@ public void PosTest3() [Fact(DisplayName = "NegTest1: The argument is a null reference")] public void NegTest1() { - IEnumerable i = null; + IEnumerable? i = null; TreeList listObject = new TreeList(); - Assert.Throws(() => listObject.AddRange(i)); + Assert.Throws(() => listObject.AddRange(i!)); } public class MyClass diff --git a/TunnelVisionLabs.Collections.Trees.Test/List/TreeListContains.cs b/TunnelVisionLabs.Collections.Trees.Test/List/TreeListContains.cs index f742750..3319b51 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/List/TreeListContains.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/List/TreeListContains.cs @@ -54,8 +54,8 @@ public void PosTest4() [Fact(DisplayName = "PosTest5: The argument is a null reference")] public void PosTest5() { - string[] strArray = { "apple", "banana", "chocolate", null, "food" }; - TreeList listObject = new TreeList(strArray); + string?[] strArray = { "apple", "banana", "chocolate", null, "food" }; + TreeList listObject = new TreeList(strArray); Assert.True(listObject.Contains(null)); } diff --git a/TunnelVisionLabs.Collections.Trees.Test/List/TreeListCtor2.cs b/TunnelVisionLabs.Collections.Trees.Test/List/TreeListCtor2.cs index 6009ce3..9cabbfa 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/List/TreeListCtor2.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/List/TreeListCtor2.cs @@ -54,8 +54,8 @@ public void PosTest4() [Fact(DisplayName = "NegTest1: The argument is a null reference")] public void NegTest1() { - IEnumerable i = null; - Assert.Throws(() => new TreeList(i)); + IEnumerable? i = null; + Assert.Throws(() => new TreeList(i!)); } public class MyClass diff --git a/TunnelVisionLabs.Collections.Trees.Test/List/TreeListForEach.cs b/TunnelVisionLabs.Collections.Trees.Test/List/TreeListForEach.cs index d974691..72c7d4f 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/List/TreeListForEach.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/List/TreeListForEach.cs @@ -57,15 +57,15 @@ public void NegTest1() { int[] iArray = { 1, 9, 3, 6, -1, 8, 7, 1, 2, 4 }; TreeList listObject = new TreeList(iArray); - Action action = null; - Assert.Throws(() => listObject.ForEach(action)); + Action? action = null; + Assert.Throws(() => listObject.ForEach(action!)); } public class MyClass { public int Sum { get; set; } = 0; - public string Result { get; set; } + public string? Result { get; set; } public void SumCalc(int a) { diff --git a/TunnelVisionLabs.Collections.Trees.Test/List/TreeListICollectionCopyTo.cs b/TunnelVisionLabs.Collections.Trees.Test/List/TreeListICollectionCopyTo.cs index 2b670ea..33a6cf2 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/List/TreeListICollectionCopyTo.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/List/TreeListICollectionCopyTo.cs @@ -76,7 +76,7 @@ public void NegTest1() { int[] iArray = { 1, 9, 3, 6, 5, 8, 7, 2, 4, 0 }; TreeList listObject = new TreeList(iArray); - Assert.Throws(() => ((ICollection)listObject).CopyTo(null, 0)); + Assert.Throws(() => ((ICollection)listObject).CopyTo(null!, 0)); } [Fact(DisplayName = "NegTest2: The number of elements in the source List is greater than the number of elements that the destination array can contain")] diff --git a/TunnelVisionLabs.Collections.Trees.Test/List/TreeListIEnumerableGetEnumerator2.cs b/TunnelVisionLabs.Collections.Trees.Test/List/TreeListIEnumerableGetEnumerator2.cs index 6e911c7..8a4bc23 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/List/TreeListIEnumerableGetEnumerator2.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/List/TreeListIEnumerableGetEnumerator2.cs @@ -30,7 +30,7 @@ public void PosTest1() int j = 0; for (IEnumerator itr = returnValue; itr.MoveNext();) { - int current = (int)itr.Current; + int current = (int)itr.Current!; Assert.Equal(expectValue[j], current); j++; @@ -55,7 +55,7 @@ public void PosTest2() int j = 0; for (IEnumerator itr = returnValue; itr.MoveNext();) { - string current = (string)itr.Current; + string? current = (string?)itr.Current; Assert.Equal(expectValue[j], current); j++; diff --git a/TunnelVisionLabs.Collections.Trees.Test/List/TreeListIListAdd.cs b/TunnelVisionLabs.Collections.Trees.Test/List/TreeListIListAdd.cs index 05929cd..7329647 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/List/TreeListIListAdd.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/List/TreeListIListAdd.cs @@ -21,7 +21,7 @@ public void PosTest1() int count = 10; int[] expectValue = new int[10]; IList myIList = myList; - object element = null; + object? element = null; for (int i = 1; i <= count; i++) { element = i * count; @@ -33,7 +33,7 @@ public void PosTest1() int j = 0; for (IEnumerator itr = returnValue; itr.MoveNext();) { - int current = (int)itr.Current; + int current = (int)itr.Current!; Assert.Equal(expectValue[j], current); j++; @@ -45,8 +45,8 @@ public void PosTest2() { TreeList myList = new TreeList(); int count = 10; - string[] expectValue = new string[10]; - object element = null; + string?[] expectValue = new string?[10]; + object? element = null; IList myIList = myList; for (int i = 1; i <= count; i++) { @@ -59,7 +59,7 @@ public void PosTest2() int j = 0; for (IEnumerator itr = returnValue; itr.MoveNext();) { - string current = (string)itr.Current; + string? current = (string?)itr.Current; Assert.Equal(expectValue[j], current); j++; diff --git a/TunnelVisionLabs.Collections.Trees.Test/List/TreeListIListContains.cs b/TunnelVisionLabs.Collections.Trees.Test/List/TreeListIListContains.cs index fae10dd..94f53fa 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/List/TreeListIListContains.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/List/TreeListIListContains.cs @@ -20,7 +20,7 @@ public void PosTest1() int count = 10; int[] expectValue = new int[10]; IList myIList = myList; - object element = null; + object? element = null; for (int i = 1; i <= count; i++) { element = i * count; @@ -36,8 +36,8 @@ public void PosTest2() { TreeList myList = new TreeList(); int count = 10; - string[] expectValue = new string[10]; - object element = null; + string?[] expectValue = new string?[10]; + object? element = null; IList myIList = myList; for (int i = 1; i <= count; i++) { diff --git a/TunnelVisionLabs.Collections.Trees.Test/List/TreeListIListIndexOf.cs b/TunnelVisionLabs.Collections.Trees.Test/List/TreeListIListIndexOf.cs index 60d4c3c..ec0bf8b 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/List/TreeListIListIndexOf.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/List/TreeListIListIndexOf.cs @@ -20,7 +20,7 @@ public void PosTest1() int count = 10; int[] expectValue = new int[10]; IList myIList = myList; - object element = null; + object? element = null; for (int i = 1; i <= count; i++) { element = i * count; @@ -40,8 +40,8 @@ public void PosTest2() { TreeList myList = new TreeList(); int count = 10; - string[] expectValue = new string[10]; - object element = null; + string?[] expectValue = new string?[10]; + object? element = null; IList myIList = myList; for (int i = 1; i <= count; i++) { @@ -62,8 +62,8 @@ public void PosTest3() { TreeList myList = new TreeList(); int count = 10; - string[] expectValue = new string[10]; - object element = null; + string?[] expectValue = new string?[10]; + object? element = null; IList myIList = myList; for (int i = 1; i <= count; i++) { diff --git a/TunnelVisionLabs.Collections.Trees.Test/List/TreeListIListInsert.cs b/TunnelVisionLabs.Collections.Trees.Test/List/TreeListIListInsert.cs index a9755e9..6af1a45 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/List/TreeListIListInsert.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/List/TreeListIListInsert.cs @@ -26,7 +26,7 @@ public void PosTest1() } IList myIList = myList; - object element = null; + object? element = null; for (int i = 1; i <= count; i++) { element = 0; @@ -44,7 +44,7 @@ public void PosTest1() int j = 0; for (IEnumerator itr = returnValue; itr.MoveNext();) { - int current = (int)itr.Current; + int current = (int)itr.Current!; Assert.Equal(expectValue[j], current); j++; @@ -56,13 +56,13 @@ public void PosTest2() { TreeList myList = new TreeList(); int count = 10; - string[] expectValue = new string[20]; + string?[] expectValue = new string?[20]; for (int z = 0; z < 20; z++) { expectValue[z] = string.Empty; } - object element = null; + object? element = null; IList myIList = myList; for (int i = 1; i <= count; i++) { @@ -81,7 +81,7 @@ public void PosTest2() int j = 0; for (IEnumerator itr = returnValue; itr.MoveNext();) { - string current = (string)itr.Current; + string current = (string)itr.Current!; Assert.Equal(expectValue[j], current); j++; diff --git a/TunnelVisionLabs.Collections.Trees.Test/List/TreeListIListItem.cs b/TunnelVisionLabs.Collections.Trees.Test/List/TreeListIListItem.cs index 0091fba..b456b13 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/List/TreeListIListItem.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/List/TreeListIListItem.cs @@ -21,7 +21,7 @@ public void PosTest1() int count = 10; int[] expectValue = new int[10]; IList myIList = myList; - object element = null; + object? element = null; for (int i = 1; i <= count; i++) { element = i * count; @@ -31,7 +31,7 @@ public void PosTest1() for (int j = 0; j < myIList.Count; j++) { - int current = (int)myIList[j]; + int current = (int)myIList[j]!; Assert.Equal(expectValue[j], current); } } @@ -41,8 +41,8 @@ public void PosTest2() { TreeList myList = new TreeList(); int count = 10; - string[] expectValue = new string[10]; - object element = null; + string?[] expectValue = new string?[10]; + object? element = null; IList myIList = myList; for (int i = 1; i <= count; i++) { @@ -53,7 +53,7 @@ public void PosTest2() for (int j = 0; j < myIList.Count; j++) { - string current = (string)myIList[j]; + string current = (string)myIList[j]!; Assert.Equal(expectValue[j], current); } } diff --git a/TunnelVisionLabs.Collections.Trees.Test/List/TreeListIListRemove.cs b/TunnelVisionLabs.Collections.Trees.Test/List/TreeListIListRemove.cs index fbcc5d1..18972a2 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/List/TreeListIListRemove.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/List/TreeListIListRemove.cs @@ -19,7 +19,7 @@ public void PosTest1() TreeList myList = new TreeList(); int count = 10; IList myIList = myList; - object element = null; + object? element = null; for (int i = 1; i <= count; i++) { element = i * count; @@ -39,7 +39,7 @@ public void PosTest2() { TreeList myList = new TreeList(); int count = 10; - object element = null; + object? element = null; IList myIList = myList; for (int i = 1; i <= count; i++) { diff --git a/TunnelVisionLabs.Collections.Trees.Test/List/TreeListInsertRange.cs b/TunnelVisionLabs.Collections.Trees.Test/List/TreeListInsertRange.cs index 0e5e145..0a79b27 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/List/TreeListInsertRange.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/List/TreeListInsertRange.cs @@ -67,8 +67,8 @@ public void PosTest3() public void PosTest4() { string[] strArray = { "apple", "dog", "banana", "food" }; - TreeList listObject = new TreeList(strArray); - string[] insert = new string[2] { null, null }; + TreeList listObject = new TreeList(strArray); + string?[] insert = new string?[2] { null, null }; int index = Generator.GetInt32(0, 4); listObject.InsertRange(index, insert); Assert.Equal(6, listObject.Count); @@ -81,9 +81,9 @@ public void NegTest1() { string[] strArray = { "apple", "dog", "banana", "food" }; TreeList listObject = new TreeList(strArray); - string[] insert = null; + string[]? insert = null; int index = Generator.GetInt32(0, 4); - Assert.Throws(() => listObject.InsertRange(index, insert)); + Assert.Throws(() => listObject.InsertRange(index, insert!)); } [Fact(DisplayName = "NegTest2: The index is negative")] diff --git a/TunnelVisionLabs.Collections.Trees.Test/List/TreeListLastIndexOf1.cs b/TunnelVisionLabs.Collections.Trees.Test/List/TreeListLastIndexOf1.cs index af4b6d4..ee8591d 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/List/TreeListLastIndexOf1.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/List/TreeListLastIndexOf1.cs @@ -70,7 +70,7 @@ public void PosTest5() public void PosTest6() { string[] strArray = { "apple", "banana", "chocolate" }; - TreeList listObject = new TreeList(strArray); + TreeList listObject = new TreeList(strArray); int result = listObject.LastIndexOf(null); Assert.Equal(-1, result); } diff --git a/TunnelVisionLabs.Collections.Trees.Test/ReverseComparer`1.cs b/TunnelVisionLabs.Collections.Trees.Test/ReverseComparer`1.cs index b04cedc..82442fa 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/ReverseComparer`1.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/ReverseComparer`1.cs @@ -4,6 +4,7 @@ namespace TunnelVisionLabs.Collections.Trees.Test { using System.Collections.Generic; + using System.Diagnostics.CodeAnalysis; internal sealed class ReverseComparer : IComparer { @@ -11,12 +12,12 @@ internal sealed class ReverseComparer : IComparer private readonly IComparer _comparer; - public ReverseComparer(IComparer comparer) + public ReverseComparer(IComparer? comparer) { _comparer = comparer ?? Comparer.Default; } - public int Compare(T x, T y) + public int Compare([AllowNull] T x, [AllowNull] T y) { var direct = _comparer.Compare(x, y); if (direct == int.MinValue) diff --git a/TunnelVisionLabs.Collections.Trees.Test/SortedTreeDictionaryTest.cs b/TunnelVisionLabs.Collections.Trees.Test/SortedTreeDictionaryTest.cs index 6cda22e..d93bb0b 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/SortedTreeDictionaryTest.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/SortedTreeDictionaryTest.cs @@ -21,8 +21,8 @@ public void TestSortedTreeDictionaryConstructor() [Fact] public void TestCollectionConstructors() { - Assert.Throws("collection", () => new SortedTreeDictionary(collection: null)); - Assert.Throws("collection", () => new SortedTreeDictionary(branchingFactor: 4, collection: null, comparer: null)); + Assert.Throws("collection", () => new SortedTreeDictionary(collection: null!)); + Assert.Throws("collection", () => new SortedTreeDictionary(branchingFactor: 4, collection: null!, comparer: null)); Assert.Throws(() => new SortedTreeDictionary(new[] { new KeyValuePair(1, 1), new KeyValuePair(1, 2) })); Assert.Throws(() => new SortedTreeDictionary(branchingFactor: 4, new[] { new KeyValuePair(1, 1), new KeyValuePair(1, 2) }, comparer: null)); @@ -95,7 +95,7 @@ public void TestIDictionaryT() Assert.Equal(Enumerable.Range(0, 9), dictionary.Values); Assert.Throws(() => dictionary.Keys.Add(0)); - Assert.Throws("array", () => dictionary.Keys.CopyTo(null, 0)); + Assert.Throws("array", () => dictionary.Keys.CopyTo(null!, 0)); Assert.Throws("arrayIndex", () => dictionary.Keys.CopyTo(new int[dictionary.Count], -1)); Assert.Throws("arrayIndex", () => dictionary.Keys.CopyTo(new int[dictionary.Count], dictionary.Count + 1)); Assert.Throws(() => dictionary.Keys.CopyTo(new int[dictionary.Count], 1)); @@ -113,7 +113,7 @@ public void TestIDictionaryT() Assert.Equal(0, keyEnumerator.Current); Assert.Throws(() => dictionary.Values.Add(0)); - Assert.Throws("array", () => dictionary.Values.CopyTo(null, 0)); + Assert.Throws("array", () => dictionary.Values.CopyTo(null!, 0)); Assert.Throws("arrayIndex", () => dictionary.Values.CopyTo(new int[dictionary.Count], -1)); Assert.Throws("arrayIndex", () => dictionary.Values.CopyTo(new int[dictionary.Count], dictionary.Count + 1)); Assert.Throws(() => dictionary.Values.CopyTo(new int[dictionary.Count], 1)); @@ -166,7 +166,7 @@ public void TestIDictionary() Assert.False(dictionary.IsReadOnly); Assert.False(dictionary.IsSynchronized); - Assert.Throws("key", () => dictionary.Add(key: null, value: 1)); + Assert.Throws("key", () => dictionary.Add(key: null!, value: 1)); Assert.Throws("value", () => dictionary.Add(key: 1, value: null)); Assert.Throws("key", () => dictionary.Add(key: "string value", value: 0)); Assert.Throws("value", () => dictionary.Add(key: 0, value: "string value")); @@ -174,11 +174,11 @@ public void TestIDictionary() for (int i = 0; i < 11; i++) dictionary.Add(i, i + 1); - Assert.Throws("key", () => dictionary[key: null]); + Assert.Throws("key", () => dictionary[key: null!]); Assert.Null(dictionary["string key"]); Assert.Equal(11, dictionary[10]); - Assert.Throws("key", () => dictionary[key: null] = 12); + Assert.Throws("key", () => dictionary[key: null!] = 12); Assert.Throws("key", () => dictionary["string key"] = 12); Assert.Throws("value", () => dictionary[10] = null); Assert.Throws("value", () => dictionary[10] = "string value"); @@ -193,11 +193,11 @@ public void TestIDictionary() Assert.Equal(entries.Select(i => i.Key), dictionary.Keys.Cast()); Assert.Equal(entries.Select(i => i.Value), dictionary.Values.Cast()); - Assert.Throws(() => dictionary.Contains(null)); + Assert.Throws(() => dictionary.Contains(null!)); Assert.False(dictionary.Contains("string value")); Assert.True(dictionary.Contains(10)); - Assert.Throws(() => dictionary.Remove(null)); + Assert.Throws(() => dictionary.Remove(null!)); Assert.Equal(11, dictionary.Count); dictionary.Remove("string value"); Assert.Equal(11, dictionary.Count); @@ -246,7 +246,7 @@ void TestCollection(ICollection collection, Func indexToExpectedValue Assert.False(collection.IsSynchronized); Assert.Same(dictionary, collection.SyncRoot); - Assert.Throws("array", () => collection.CopyTo(null, 0)); + Assert.Throws("array", () => collection.CopyTo(null!, 0)); Assert.Throws(() => collection.CopyTo(new int[collection.Count, 1], 0)); Assert.Throws(() => collection.CopyTo(Array.CreateInstance(typeof(int), lengths: new[] { collection.Count }, lowerBounds: new[] { 1 }), 0)); Assert.Throws("index", () => collection.CopyTo(new int[collection.Count], -1)); diff --git a/TunnelVisionLabs.Collections.Trees.Test/SortedTreeListTest.cs b/TunnelVisionLabs.Collections.Trees.Test/SortedTreeListTest.cs index 21d968a..82531c8 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/SortedTreeListTest.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/SortedTreeListTest.cs @@ -20,7 +20,7 @@ public void TestTreeListConstructor() SortedTreeList list = new SortedTreeList(); Assert.Empty(list); - Assert.Throws(() => new SortedTreeList(collection: null)); + Assert.Throws(() => new SortedTreeList(collection: null!)); } [Fact] @@ -134,7 +134,7 @@ private static void TestIListInterfaceImpl(IList list, bool supportsNullValues) list.Remove("Text"); Assert.Equal(originalCount, list.Count); - object removedItem = list[0]; + object? removedItem = list[0]; list.Remove(list[0]); Assert.Equal(originalCount - 1, list.Count); Assert.True(list.Contains(removedItem)); @@ -292,7 +292,7 @@ public void TestIndexer() public void TestCopyToValidation() { SortedTreeList list = new SortedTreeList(Enumerable.Range(0, 10)); - Assert.Throws("dest", () => list.CopyTo(0, null, 0, list.Count)); + Assert.Throws("dest", () => list.CopyTo(0, null!, 0, list.Count)); Assert.Throws("srcIndex", () => list.CopyTo(-1, new int[list.Count], 0, list.Count)); Assert.Throws("dstIndex", () => list.CopyTo(0, new int[list.Count], -1, list.Count)); Assert.Throws("length", () => list.CopyTo(0, new int[list.Count], 0, -1)); @@ -356,7 +356,7 @@ public void TestAddRange() int[] actual = list.ToArray(); Assert.Equal(expected, actual); - Assert.Throws(() => list.AddRange(null)); + Assert.Throws(() => list.AddRange(null!)); } [Fact] @@ -431,8 +431,8 @@ public void TestForEach() var list = new SortedTreeList(branchingFactor: 4, collection: Enumerable.Range(0, 100), comparer: null); var reference = new List(Enumerable.Range(0, 100)); - Assert.Throws("action", () => list.ForEach(null)); - Assert.Throws(() => reference.ForEach(null)); + Assert.Throws("action", () => list.ForEach(null!)); + Assert.Throws(() => reference.ForEach(null!)); var listOutput = new List(); var referenceOutput = new List(); @@ -586,9 +586,9 @@ public void TestFindIndex() reference.Sort(); - Assert.Throws(() => list.FindIndex(null)); - Assert.Throws(() => list.FindIndex(0, null)); - Assert.Throws(() => list.FindIndex(0, 0, null)); + Assert.Throws(() => list.FindIndex(null!)); + Assert.Throws(() => list.FindIndex(0, null!)); + Assert.Throws(() => list.FindIndex(0, 0, null!)); Assert.Throws(() => list.FindIndex(-1, i => true)); Assert.Throws(() => list.FindIndex(0, -1, i => true)); @@ -629,9 +629,9 @@ public void TestFindLastIndex() reference.Sort(); - Assert.Throws(() => list.FindLastIndex(null)); - Assert.Throws(() => list.FindLastIndex(-1, null)); - Assert.Throws(() => list.FindLastIndex(-1, 0, null)); + Assert.Throws(() => list.FindLastIndex(null!)); + Assert.Throws(() => list.FindLastIndex(-1, null!)); + Assert.Throws(() => list.FindLastIndex(-1, 0, null!)); Assert.Throws(() => list.FindLastIndex(list.Count, i => true)); Assert.Throws(() => list.FindLastIndex(list.Count - 1, -1, i => true)); @@ -813,7 +813,7 @@ public void TestRemoveValue() public void TestRemoveAll() { var list = new SortedTreeList(4, Enumerable.Range(0, 10), comparer: null); - Assert.Throws(() => list.RemoveAll(null)); + Assert.Throws(() => list.RemoveAll(null!)); Assert.Equal(5, list.RemoveAll(i => (i % 2) == 0)); Assert.Equal(new[] { 1, 3, 5, 7, 9 }, list); @@ -825,7 +825,7 @@ public void TestRemoveAll() public void TestExists() { var list = new SortedTreeList(4, Enumerable.Range(0, 10), comparer: null); - Assert.Throws(() => list.Exists(null)); + Assert.Throws(() => list.Exists(null!)); Assert.False(list.Exists(value => value < 0)); foreach (var i in list) @@ -840,7 +840,7 @@ public void TestExists() public void TestFind() { var list = new SortedTreeList(4, Enumerable.Range(1, 10), comparer: null); - Assert.Throws(() => list.Find(null)); + Assert.Throws(() => list.Find(null!)); Assert.Equal(0, list.Find(value => value < 0)); foreach (var i in list) @@ -855,7 +855,7 @@ public void TestFind() public void TestFindAll() { var list = new SortedTreeList(4, Enumerable.Range(0, 10), comparer: null); - Assert.Throws(() => list.FindAll(null)); + Assert.Throws(() => list.FindAll(null!)); SortedTreeList found = list.FindAll(i => (i % 2) == 0); @@ -871,7 +871,7 @@ public void TestFindLast() { var list = new SortedTreeList(4, Enumerable.Range(1, 10), comparer: null); var reference = new List(Enumerable.Range(1, 10)); - Assert.Throws(() => list.FindLast(null)); + Assert.Throws(() => list.FindLast(null!)); Assert.Equal(0, list.FindLast(i => i < 0)); Assert.Equal(0, reference.FindLast(i => i < 0)); @@ -888,7 +888,7 @@ public void TestTrueForAll() { var list = new SortedTreeList(); Assert.True(list.TrueForAll(i => false)); - Assert.Throws(() => list.TrueForAll(null)); + Assert.Throws(() => list.TrueForAll(null!)); list.Add(1); Assert.True(list.TrueForAll(i => i > 0)); diff --git a/TunnelVisionLabs.Collections.Trees.Test/SortedTreeSetTest.cs b/TunnelVisionLabs.Collections.Trees.Test/SortedTreeSetTest.cs index f3a21b0..9293d8c 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/SortedTreeSetTest.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/SortedTreeSetTest.cs @@ -6,6 +6,7 @@ namespace TunnelVisionLabs.Collections.Trees.Test using System; using System.Collections; using System.Collections.Generic; + using System.Diagnostics.CodeAnalysis; using System.Linq; using Xunit; @@ -21,7 +22,7 @@ public void TestTreeSetConstructor() [Fact] public void TestCollectionConstructor() { - Assert.Throws(() => new SortedTreeSet(collection: null)); + Assert.Throws(() => new SortedTreeSet(collection: null!)); var set = new SortedTreeSet(new[] { 1, 1 }); Assert.Single(set); @@ -52,8 +53,8 @@ public void TestEmptySetMinMax() private void TestEmptySetMinMaxImpl() { var set = new SortedTreeSet(); - Assert.Equal(default, set.Min); - Assert.Equal(default, set.Max); + Assert.Equal(default!, set.Min!); + Assert.Equal(default!, set.Max!); } [Fact] @@ -147,7 +148,7 @@ public void TestICollectionInterface() public void TestCopyToValidation() { SortedTreeSet set = new SortedTreeSet(Enumerable.Range(0, 10)); - Assert.Throws("dest", () => set.CopyTo(null, 0, set.Count)); + Assert.Throws("dest", () => set.CopyTo(null!, 0, set.Count)); Assert.Throws("dstIndex", () => set.CopyTo(new int[set.Count], -1, set.Count)); Assert.Throws("length", () => set.CopyTo(new int[set.Count], 0, -1)); Assert.Throws(string.Empty, () => set.CopyTo(new int[set.Count], 1, set.Count)); @@ -305,11 +306,11 @@ public void TestTrimExcess() [Fact] public void TestTryGetValue() { - var set = new SortedTreeSet(StringComparer.OrdinalIgnoreCase); + var set = new SortedTreeSet(StringComparer.OrdinalIgnoreCase); Assert.True(set.Add("a")); Assert.False(set.Add("A")); - Assert.True(set.TryGetValue("a", out string value)); + Assert.True(set.TryGetValue("a", out string? value)); Assert.Equal("a", value); Assert.True(set.TryGetValue("A", out value)); @@ -395,7 +396,7 @@ public void TestRemoveValue() public void TestRemoveWhere() { var set = new SortedTreeSet(4, Enumerable.Range(0, 10), comparer: null); - Assert.Throws(() => set.RemoveWhere(null)); + Assert.Throws(() => set.RemoveWhere(null!)); Assert.Equal(5, set.RemoveWhere(i => (i % 2) == 0)); Assert.Equal(new[] { 1, 3, 5, 7, 9 }, set); @@ -406,10 +407,10 @@ public void TestRemoveWhere() [Fact] public void TestSetComparer() { - IEqualityComparer> setComparer = SortedTreeSet.CreateSetComparer(); + IEqualityComparer?> setComparer = SortedTreeSet.CreateSetComparer(); Assert.True(setComparer.Equals(SortedTreeSet.CreateSetComparer())); Assert.False(setComparer.Equals(null)); - Assert.Equal(setComparer.GetHashCode(), SortedTreeSet.CreateSetComparer().GetHashCode()); + Assert.Equal(setComparer!.GetHashCode(), SortedTreeSet.CreateSetComparer().GetHashCode()); var set = new SortedTreeSet(); var other = new SortedTreeSet(); @@ -426,7 +427,7 @@ public void TestSetComparer() Assert.Equal(setComparer.GetHashCode(set), setComparer.GetHashCode(other)); // Test behavior with non-empty sets - set.UnionWith(Enumerable.Range(0, 10)); + set!.UnionWith(Enumerable.Range(0, 10)); Assert.False(setComparer.Equals(set, other)); other.UnionWith(Enumerable.Range(0, 5)); Assert.False(setComparer.Equals(set, other)); @@ -478,12 +479,12 @@ private sealed class ReversingComparer : IComparer private readonly IComparer _comparer; - public ReversingComparer(IComparer comparer) + public ReversingComparer(IComparer? comparer) { _comparer = comparer ?? Comparer.Default; } - public int Compare(T x, T y) => -_comparer.Compare(x, y); + public int Compare([AllowNull] T x, [AllowNull] T y) => -_comparer.Compare(x, y); } } } diff --git a/TunnelVisionLabs.Collections.Trees.Test/SubsetHashCodeEqualityComparer`1.cs b/TunnelVisionLabs.Collections.Trees.Test/SubsetHashCodeEqualityComparer`1.cs index 47f51da..cba8d61 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/SubsetHashCodeEqualityComparer`1.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/SubsetHashCodeEqualityComparer`1.cs @@ -5,6 +5,7 @@ namespace TunnelVisionLabs.Collections.Trees.Test { using System; using System.Collections.Generic; + using System.Diagnostics.CodeAnalysis; internal sealed class SubsetHashCodeEqualityComparer : IEqualityComparer { @@ -22,7 +23,7 @@ public SubsetHashCodeEqualityComparer(IEqualityComparer equalityComparer, Fun _getHashCode = getHashCode; } - public bool Equals(T x, T y) => _equalityComparer.Equals(x, y); + public bool Equals([AllowNull] T x, [AllowNull] T y) => _equalityComparer.Equals(x, y); public int GetHashCode(T obj) => _getHashCode(obj); } diff --git a/TunnelVisionLabs.Collections.Trees.Test/TreeDictionaryTest.cs b/TunnelVisionLabs.Collections.Trees.Test/TreeDictionaryTest.cs index 1fbef6d..e4e3dc7 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/TreeDictionaryTest.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/TreeDictionaryTest.cs @@ -21,8 +21,8 @@ public void TestTreeDictionaryConstructor() [Fact] public void TestCollectionConstructors() { - Assert.Throws("collection", () => new TreeDictionary(collection: null)); - Assert.Throws("collection", () => new TreeDictionary(branchingFactor: 4, collection: null, comparer: null)); + Assert.Throws("collection", () => new TreeDictionary(collection: null!)); + Assert.Throws("collection", () => new TreeDictionary(branchingFactor: 4, collection: null!, comparer: null)); Assert.Throws(() => new TreeDictionary(new[] { new KeyValuePair(1, 1), new KeyValuePair(1, 2) })); Assert.Throws(() => new TreeDictionary(branchingFactor: 4, new[] { new KeyValuePair(1, 1), new KeyValuePair(1, 2) }, comparer: null)); @@ -95,7 +95,7 @@ public void TestIDictionaryT() Assert.Equal(Enumerable.Range(0, 9), dictionary.Values); Assert.Throws(() => dictionary.Keys.Add(0)); - Assert.Throws("array", () => dictionary.Keys.CopyTo(null, 0)); + Assert.Throws("array", () => dictionary.Keys.CopyTo(null!, 0)); Assert.Throws("arrayIndex", () => dictionary.Keys.CopyTo(new int[dictionary.Count], -1)); Assert.Throws("arrayIndex", () => dictionary.Keys.CopyTo(new int[dictionary.Count], dictionary.Count + 1)); Assert.Throws(() => dictionary.Keys.CopyTo(new int[dictionary.Count], 1)); @@ -113,7 +113,7 @@ public void TestIDictionaryT() Assert.Equal(0, keyEnumerator.Current); Assert.Throws(() => dictionary.Values.Add(0)); - Assert.Throws("array", () => dictionary.Values.CopyTo(null, 0)); + Assert.Throws("array", () => dictionary.Values.CopyTo(null!, 0)); Assert.Throws("arrayIndex", () => dictionary.Values.CopyTo(new int[dictionary.Count], -1)); Assert.Throws("arrayIndex", () => dictionary.Values.CopyTo(new int[dictionary.Count], dictionary.Count + 1)); Assert.Throws(() => dictionary.Values.CopyTo(new int[dictionary.Count], 1)); @@ -166,7 +166,7 @@ public void TestIDictionary() Assert.False(dictionary.IsReadOnly); Assert.False(dictionary.IsSynchronized); - Assert.Throws("key", () => dictionary.Add(key: null, value: 1)); + Assert.Throws("key", () => dictionary.Add(key: null!, value: 1)); Assert.Throws("value", () => dictionary.Add(key: 1, value: null)); Assert.Throws("key", () => dictionary.Add(key: "string value", value: 0)); Assert.Throws("value", () => dictionary.Add(key: 0, value: "string value")); @@ -174,11 +174,11 @@ public void TestIDictionary() for (int i = 0; i < 11; i++) dictionary.Add(i, i + 1); - Assert.Throws("key", () => dictionary[key: null]); + Assert.Throws("key", () => dictionary[key: null!]); Assert.Null(dictionary["string key"]); Assert.Equal(11, dictionary[10]); - Assert.Throws("key", () => dictionary[key: null] = 12); + Assert.Throws("key", () => dictionary[key: null!] = 12); Assert.Throws("key", () => dictionary["string key"] = 12); Assert.Throws("value", () => dictionary[10] = null); Assert.Throws("value", () => dictionary[10] = "string value"); @@ -193,11 +193,11 @@ public void TestIDictionary() Assert.Equal(entries.Select(i => i.Key), dictionary.Keys.Cast()); Assert.Equal(entries.Select(i => i.Value), dictionary.Values.Cast()); - Assert.Throws(() => dictionary.Contains(null)); + Assert.Throws(() => dictionary.Contains(null!)); Assert.False(dictionary.Contains("string value")); Assert.True(dictionary.Contains(10)); - Assert.Throws(() => dictionary.Remove(null)); + Assert.Throws(() => dictionary.Remove(null!)); Assert.Equal(11, dictionary.Count); dictionary.Remove("string value"); Assert.Equal(11, dictionary.Count); @@ -246,7 +246,7 @@ void TestCollection(ICollection collection, Func indexToExpectedValue Assert.False(collection.IsSynchronized); Assert.Same(dictionary, collection.SyncRoot); - Assert.Throws("array", () => collection.CopyTo(null, 0)); + Assert.Throws("array", () => collection.CopyTo(null!, 0)); Assert.Throws(() => collection.CopyTo(new int[collection.Count, 1], 0)); Assert.Throws(() => collection.CopyTo(Array.CreateInstance(typeof(int), lengths: new[] { collection.Count }, lowerBounds: new[] { 1 }), 0)); Assert.Throws("index", () => collection.CopyTo(new int[collection.Count], -1)); diff --git a/TunnelVisionLabs.Collections.Trees.Test/TreeListTest.cs b/TunnelVisionLabs.Collections.Trees.Test/TreeListTest.cs index 5c34fa4..02ac2a0 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/TreeListTest.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/TreeListTest.cs @@ -77,7 +77,7 @@ private static void TestIListInterfaceImpl(IList list, bool supportsNullValues) list.Remove("Text"); Assert.Equal(originalCount, list.Count); - object removedItem = list[0]; + object? removedItem = list[0]; list.Remove(list[0]); Assert.Equal(originalCount - 1, list.Count); Assert.True(list.Contains(removedItem)); @@ -208,8 +208,8 @@ public void TestIndexer() public void TestCopyToValidation() { TreeList list = new TreeList(Enumerable.Range(0, 10)); - Assert.Throws("dest", () => list.CopyTo(null)); - Assert.Throws("dest", () => list.CopyTo(0, null, 0, list.Count)); + Assert.Throws("dest", () => list.CopyTo(null!)); + Assert.Throws("dest", () => list.CopyTo(0, null!, 0, list.Count)); Assert.Throws("srcIndex", () => list.CopyTo(-1, new int[list.Count], 0, list.Count)); Assert.Throws("dstIndex", () => list.CopyTo(0, new int[list.Count], -1, list.Count)); Assert.Throws("length", () => list.CopyTo(0, new int[list.Count], 0, -1)); @@ -217,7 +217,7 @@ public void TestCopyToValidation() Assert.Throws(string.Empty, () => list.CopyTo(0, new int[list.Count], 1, list.Count)); ICollection collection = list; - Assert.Throws("dest", () => collection.CopyTo(null, 0)); + Assert.Throws("dest", () => collection.CopyTo(null!, 0)); Assert.Throws("dstIndex", () => collection.CopyTo(new int[collection.Count], -1)); Assert.Throws("dstIndex", () => collection.CopyTo(Array.CreateInstance(typeof(int), new[] { list.Count }, new[] { 1 }), 0)); Assert.Throws(string.Empty, () => collection.CopyTo(new int[collection.Count], collection.Count + 1)); @@ -474,9 +474,9 @@ public void TestFindIndex() reference.Insert(index, i); } - Assert.Throws(() => list.FindIndex(null)); - Assert.Throws(() => list.FindIndex(0, null)); - Assert.Throws(() => list.FindIndex(0, 0, null)); + Assert.Throws(() => list.FindIndex(null!)); + Assert.Throws(() => list.FindIndex(0, null!)); + Assert.Throws(() => list.FindIndex(0, 0, null!)); Assert.Throws(() => list.FindIndex(-1, i => true)); Assert.Throws(() => list.FindIndex(0, -1, i => true)); @@ -515,9 +515,9 @@ public void TestFindLastIndex() reference.Insert(index, i); } - Assert.Throws(() => list.FindLastIndex(null)); - Assert.Throws(() => list.FindLastIndex(-1, null)); - Assert.Throws(() => list.FindLastIndex(-1, 0, null)); + Assert.Throws(() => list.FindLastIndex(null!)); + Assert.Throws(() => list.FindLastIndex(-1, null!)); + Assert.Throws(() => list.FindLastIndex(-1, 0, null!)); Assert.Throws(() => list.FindLastIndex(list.Count, i => true)); Assert.Throws(() => list.FindLastIndex(list.Count - 1, -1, i => true)); @@ -714,7 +714,7 @@ public void TestSortComparison() reference.Insert(index, item); } - Assert.Throws(() => list.Sort((Comparison)null)); + Assert.Throws(() => list.Sort((Comparison)null!)); Comparison comparison = (x, y) => x - y; list.Sort(comparison); @@ -935,7 +935,7 @@ public void TestRemoveValue() public void TestRemoveAll() { var list = new TreeList(4, Enumerable.Range(0, 10)); - Assert.Throws(() => list.RemoveAll(null)); + Assert.Throws(() => list.RemoveAll(null!)); Assert.Equal(5, list.RemoveAll(i => (i % 2) == 0)); Assert.Equal(new[] { 1, 3, 5, 7, 9 }, list); @@ -947,7 +947,7 @@ public void TestRemoveAll() public void TestExists() { var list = new TreeList(4, Enumerable.Range(0, 10)); - Assert.Throws(() => list.Exists(null)); + Assert.Throws(() => list.Exists(null!)); Assert.False(list.Exists(value => value < 0)); foreach (var i in list) @@ -962,7 +962,7 @@ public void TestExists() public void TestFind() { var list = new TreeList(4, Enumerable.Range(1, 10)); - Assert.Throws(() => list.Find(null)); + Assert.Throws(() => list.Find(null!)); Assert.Equal(0, list.Find(value => value < 0)); foreach (var i in list) @@ -977,7 +977,7 @@ public void TestFind() public void TestFindAll() { var list = new TreeList(4, Enumerable.Range(0, 10)); - Assert.Throws(() => list.FindAll(null)); + Assert.Throws(() => list.FindAll(null!)); TreeList found = list.FindAll(i => (i % 2) == 0); @@ -993,7 +993,7 @@ public void TestFindLast() { var list = new TreeList(4, Enumerable.Range(1, 10)); var reference = new List(Enumerable.Range(1, 10)); - Assert.Throws(() => list.FindLast(null)); + Assert.Throws(() => list.FindLast(null!)); Assert.Equal(0, list.FindLast(i => i < 0)); Assert.Equal(0, reference.FindLast(i => i < 0)); @@ -1010,7 +1010,7 @@ public void TestTrueForAll() { var list = new TreeList(); Assert.True(list.TrueForAll(i => false)); - Assert.Throws(() => list.TrueForAll(null)); + Assert.Throws(() => list.TrueForAll(null!)); list.Add(1); Assert.True(list.TrueForAll(i => i > 0)); diff --git a/TunnelVisionLabs.Collections.Trees.Test/TreeQueueTest.cs b/TunnelVisionLabs.Collections.Trees.Test/TreeQueueTest.cs index aecf3bb..1ad8b27 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/TreeQueueTest.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/TreeQueueTest.cs @@ -108,12 +108,12 @@ private static void TestICollectionInterfaceImpl(ICollection collection, bool is public void TestCopyToValidation() { TreeQueue queue = CreateTreeQueue(Enumerable.Range(0, 10)); - Assert.Throws("dest", () => queue.CopyTo(null, 0)); + Assert.Throws("dest", () => queue.CopyTo(null!, 0)); Assert.Throws("dstIndex", () => queue.CopyTo(new int[queue.Count], -1)); Assert.Throws(string.Empty, () => queue.CopyTo(new int[queue.Count], 1)); ICollection collection = queue; - Assert.Throws("dest", () => collection.CopyTo(null, 0)); + Assert.Throws("dest", () => collection.CopyTo(null!, 0)); Assert.Throws("dstIndex", () => collection.CopyTo(new int[collection.Count], -1)); Assert.Throws("dstIndex", () => collection.CopyTo(Array.CreateInstance(typeof(int), new[] { queue.Count }, new[] { 1 }), 0)); Assert.Throws(string.Empty, () => collection.CopyTo(new int[collection.Count], collection.Count + 1)); diff --git a/TunnelVisionLabs.Collections.Trees.Test/TreeSetTest.cs b/TunnelVisionLabs.Collections.Trees.Test/TreeSetTest.cs index 8b5a3b1..258288e 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/TreeSetTest.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/TreeSetTest.cs @@ -20,8 +20,8 @@ public void TestTreeSetConstructor() [Fact] public void TestCollectionConstructors() { - Assert.Throws("collection", () => new TreeSet(collection: null)); - Assert.Throws("collection", () => new TreeSet(branchingFactor: 4, collection: null, comparer: null)); + Assert.Throws("collection", () => new TreeSet(collection: null!)); + Assert.Throws("collection", () => new TreeSet(branchingFactor: 4, collection: null!, comparer: null)); var set = new TreeSet(new[] { 1, 1 }); Assert.Single(set); @@ -150,7 +150,7 @@ public void TestICollectionInterface() public void TestCopyToValidation() { TreeSet set = new TreeSet(Enumerable.Range(0, 10)); - Assert.Throws("array", () => set.CopyTo(null, 0, set.Count)); + Assert.Throws("array", () => set.CopyTo(null!, 0, set.Count)); Assert.Throws("arrayIndex", () => set.CopyTo(new int[set.Count], -1, set.Count)); Assert.Throws("count", () => set.CopyTo(new int[set.Count], 0, -1)); Assert.Throws(string.Empty, () => set.CopyTo(new int[set.Count], 1, set.Count)); @@ -308,11 +308,11 @@ public void TestTrimExcess() [Fact] public void TestTryGetValue() { - var set = new TreeSet(StringComparer.OrdinalIgnoreCase); + var set = new TreeSet(StringComparer.OrdinalIgnoreCase); Assert.True(set.Add("a")); Assert.False(set.Add("A")); - Assert.True(set.TryGetValue("a", out string value)); + Assert.True(set.TryGetValue("a", out string? value)); Assert.Equal("a", value); Assert.True(set.TryGetValue("A", out value)); @@ -398,7 +398,7 @@ public void TestRemoveValue() public void TestRemoveWhere() { var set = new TreeSet(4, Enumerable.Range(0, 10), comparer: null); - Assert.Throws(() => set.RemoveWhere(null)); + Assert.Throws(() => set.RemoveWhere(null!)); Assert.Equal(5, set.RemoveWhere(i => (i % 2) == 0)); Assert.Equal(new[] { 1, 3, 5, 7, 9 }, set); @@ -409,10 +409,10 @@ public void TestRemoveWhere() [Fact] public void TestSetComparer() { - IEqualityComparer> setComparer = TreeSet.CreateSetComparer(); + IEqualityComparer?> setComparer = TreeSet.CreateSetComparer(); Assert.True(setComparer.Equals(TreeSet.CreateSetComparer())); Assert.False(setComparer.Equals(null)); - Assert.Equal(setComparer.GetHashCode(), TreeSet.CreateSetComparer().GetHashCode()); + Assert.Equal(setComparer!.GetHashCode(), TreeSet.CreateSetComparer().GetHashCode()); var set = new TreeSet(); var other = new TreeSet(); @@ -429,7 +429,7 @@ public void TestSetComparer() Assert.Equal(setComparer.GetHashCode(set), setComparer.GetHashCode(other)); // Test behavior with non-empty sets - set.UnionWith(Enumerable.Range(0, 10)); + set!.UnionWith(Enumerable.Range(0, 10)); Assert.False(setComparer.Equals(set, other)); other.UnionWith(Enumerable.Range(0, 5)); Assert.False(setComparer.Equals(set, other)); diff --git a/TunnelVisionLabs.Collections.Trees.Test/TreeSetWithCollidingHashCodesTest.cs b/TunnelVisionLabs.Collections.Trees.Test/TreeSetWithCollidingHashCodesTest.cs index 9e84b8e..793c430 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/TreeSetWithCollidingHashCodesTest.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/TreeSetWithCollidingHashCodesTest.cs @@ -17,11 +17,11 @@ public partial class TreeSetWithCollidingHashCodesTest : AbstractSetTest [Fact] public void TestTryGetValueWithCollidingHashCodes() { - var set = new TreeSet(new ZeroHashCodeEqualityComparer(StringComparer.OrdinalIgnoreCase)); + var set = new TreeSet(new ZeroHashCodeEqualityComparer(StringComparer.OrdinalIgnoreCase)); Assert.True(set.Add("a")); Assert.False(set.Add("A")); - Assert.True(set.TryGetValue("a", out string value)); + Assert.True(set.TryGetValue("a", out string? value)); Assert.Equal("a", value); Assert.True(set.TryGetValue("A", out value)); @@ -32,7 +32,7 @@ public void TestTryGetValueWithCollidingHashCodes() // The test below forces coverage of an edge case. We don't know if the hash code for 'aa' or 'bb' comes // first, so write the test in a way that either will cover the early-exit branch in TryGetValue. - set = new TreeSet(new SubsetHashCodeEqualityComparer(StringComparer.Ordinal, StringComparer.OrdinalIgnoreCase)); + set = new TreeSet(new SubsetHashCodeEqualityComparer(StringComparer.Ordinal, StringComparer.OrdinalIgnoreCase)); Assert.True(set.Add("aa")); Assert.True(set.Add("Aa")); Assert.True(set.Add("bb")); diff --git a/TunnelVisionLabs.Collections.Trees.Test/TreeStackTest.cs b/TunnelVisionLabs.Collections.Trees.Test/TreeStackTest.cs index 9d57222..f99d7cb 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/TreeStackTest.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/TreeStackTest.cs @@ -108,12 +108,12 @@ private static void TestICollectionInterfaceImpl(ICollection collection, bool is public void TestCopyToValidation() { TreeStack stack = CreateTreeStack(Enumerable.Range(0, 10)); - Assert.Throws("dest", () => stack.CopyTo(null, 0)); + Assert.Throws("dest", () => stack.CopyTo(null!, 0)); Assert.Throws("dstIndex", () => stack.CopyTo(new int[stack.Count], -1)); Assert.Throws(string.Empty, () => stack.CopyTo(new int[stack.Count], 1)); ICollection collection = stack; - Assert.Throws("dest", () => collection.CopyTo(null, 0)); + Assert.Throws("dest", () => collection.CopyTo(null!, 0)); Assert.Throws("dstIndex", () => collection.CopyTo(new int[collection.Count], -1)); Assert.Throws("dstIndex", () => collection.CopyTo(Array.CreateInstance(typeof(int), new[] { stack.Count }, new[] { 1 }), 0)); Assert.Throws(string.Empty, () => collection.CopyTo(new int[collection.Count], collection.Count + 1)); diff --git a/TunnelVisionLabs.Collections.Trees.Test/ZeroHashCodeEqualityComparer`1.cs b/TunnelVisionLabs.Collections.Trees.Test/ZeroHashCodeEqualityComparer`1.cs index 287c015..3cf2b9f 100644 --- a/TunnelVisionLabs.Collections.Trees.Test/ZeroHashCodeEqualityComparer`1.cs +++ b/TunnelVisionLabs.Collections.Trees.Test/ZeroHashCodeEqualityComparer`1.cs @@ -4,18 +4,19 @@ namespace TunnelVisionLabs.Collections.Trees.Test { using System.Collections.Generic; + using System.Diagnostics.CodeAnalysis; internal sealed class ZeroHashCodeEqualityComparer : IEqualityComparer { public static readonly ZeroHashCodeEqualityComparer Default = new ZeroHashCodeEqualityComparer(null); private readonly IEqualityComparer _comparer; - public ZeroHashCodeEqualityComparer(IEqualityComparer comparer) + public ZeroHashCodeEqualityComparer(IEqualityComparer? comparer) { _comparer = comparer ?? EqualityComparer.Default; } - public bool Equals(T x, T y) => _comparer.Equals(x, y); + public bool Equals([AllowNull] T x, [AllowNull] T y) => _comparer.Equals(x, y); public int GetHashCode(T obj) => 0; } diff --git a/TunnelVisionLabs.Collections.Trees/ComparisonComparer`1.cs b/TunnelVisionLabs.Collections.Trees/ComparisonComparer`1.cs index 65de461..f76b043 100644 --- a/TunnelVisionLabs.Collections.Trees/ComparisonComparer`1.cs +++ b/TunnelVisionLabs.Collections.Trees/ComparisonComparer`1.cs @@ -6,6 +6,7 @@ namespace TunnelVisionLabs.Collections.Trees using System; using System.Collections.Generic; using System.Diagnostics; + using System.Diagnostics.CodeAnalysis; internal sealed class ComparisonComparer : IComparer { @@ -17,6 +18,8 @@ public ComparisonComparer(Comparison comparison) _comparison = comparison; } - public int Compare(T x, T y) => _comparison(x, y); +#pragma warning disable CS8604 // Possible null reference argument. (.NET 5 corrected the signature of Comparison) + public int Compare([AllowNull] T x, [AllowNull] T y) => _comparison(x, y); +#pragma warning restore CS8604 // Possible null reference argument. } } diff --git a/TunnelVisionLabs.Collections.Trees/Immutable/FixedArray8`1.cs b/TunnelVisionLabs.Collections.Trees/Immutable/FixedArray8`1.cs index 91fad50..4c7ccd7 100644 --- a/TunnelVisionLabs.Collections.Trees/Immutable/FixedArray8`1.cs +++ b/TunnelVisionLabs.Collections.Trees/Immutable/FixedArray8`1.cs @@ -6,6 +6,7 @@ namespace TunnelVisionLabs.Collections.Trees.Immutable using System; using System.Collections.Generic; using System.Diagnostics; + using System.Runtime.CompilerServices; internal struct FixedArray8 { @@ -193,11 +194,18 @@ internal void Copy(int sourceIndex, Array destinationArray, int destinationIndex } } - internal void Clear(int index, int length) + internal void MarkAsUnused(int index, int length) { +#if !NET45 && !NETSTANDARD1_1 && !NETSTANDARD2_0 + if (!RuntimeHelpers.IsReferenceOrContainsReferences()) + { + return; + } +#endif + for (int i = 0; i < length; i++) { - this[i + index] = default; + this[i + index] = default!; } } diff --git a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeDictionary.cs b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeDictionary.cs index 9260c6d..014bdad 100644 --- a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeDictionary.cs +++ b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeDictionary.cs @@ -10,39 +10,51 @@ namespace TunnelVisionLabs.Collections.Trees.Immutable public static class ImmutableSortedTreeDictionary { public static ImmutableSortedTreeDictionary Create() + where TKey : notnull => ImmutableSortedTreeDictionary.Empty; - public static ImmutableSortedTreeDictionary Create(IComparer keyComparer) + public static ImmutableSortedTreeDictionary Create(IComparer? keyComparer) + where TKey : notnull => ImmutableSortedTreeDictionary.Empty.WithComparers(keyComparer); - public static ImmutableSortedTreeDictionary Create(IComparer keyComparer, IEqualityComparer valueComparer) + public static ImmutableSortedTreeDictionary Create(IComparer? keyComparer, IEqualityComparer? valueComparer) + where TKey : notnull => ImmutableSortedTreeDictionary.Empty.WithComparers(keyComparer, valueComparer); public static ImmutableSortedTreeDictionary.Builder CreateBuilder() + where TKey : notnull => Create().ToBuilder(); - public static ImmutableSortedTreeDictionary.Builder CreateBuilder(IComparer keyComparer) + public static ImmutableSortedTreeDictionary.Builder CreateBuilder(IComparer? keyComparer) + where TKey : notnull => Create(keyComparer).ToBuilder(); - public static ImmutableSortedTreeDictionary.Builder CreateBuilder(IComparer keyComparer, IEqualityComparer valueComparer) + public static ImmutableSortedTreeDictionary.Builder CreateBuilder(IComparer? keyComparer, IEqualityComparer? valueComparer) + where TKey : notnull => Create(keyComparer, valueComparer).ToBuilder(); public static ImmutableSortedTreeDictionary CreateRange(IEnumerable> items) + where TKey : notnull => ImmutableSortedTreeDictionary.Empty.AddRange(items); - public static ImmutableSortedTreeDictionary CreateRange(IComparer keyComparer, IEnumerable> items) + public static ImmutableSortedTreeDictionary CreateRange(IComparer? keyComparer, IEnumerable> items) + where TKey : notnull => ImmutableSortedTreeDictionary.Empty.WithComparers(keyComparer).AddRange(items); - public static ImmutableSortedTreeDictionary CreateRange(IComparer keyComparer, IEqualityComparer valueComparer, IEnumerable> items) + public static ImmutableSortedTreeDictionary CreateRange(IComparer? keyComparer, IEqualityComparer? valueComparer, IEnumerable> items) + where TKey : notnull => ImmutableSortedTreeDictionary.Empty.WithComparers(keyComparer, valueComparer).AddRange(items); public static ImmutableSortedTreeDictionary ToImmutableSortedTreeDictionary(this IEnumerable> items) + where TKey : notnull => ToImmutableSortedTreeDictionary(items, keyComparer: null, valueComparer: null); - public static ImmutableSortedTreeDictionary ToImmutableSortedTreeDictionary(this IEnumerable> items, IComparer keyComparer) + public static ImmutableSortedTreeDictionary ToImmutableSortedTreeDictionary(this IEnumerable> items, IComparer? keyComparer) + where TKey : notnull => ToImmutableSortedTreeDictionary(items, keyComparer, valueComparer: null); - public static ImmutableSortedTreeDictionary ToImmutableSortedTreeDictionary(this IEnumerable> items, IComparer keyComparer, IEqualityComparer valueComparer) + public static ImmutableSortedTreeDictionary ToImmutableSortedTreeDictionary(this IEnumerable> items, IComparer? keyComparer, IEqualityComparer? valueComparer) + where TKey : notnull { if (items is null) throw new ArgumentNullException(nameof(items)); @@ -54,12 +66,15 @@ public static ImmutableSortedTreeDictionary ToImmutableSortedTreeD } public static ImmutableSortedTreeDictionary ToImmutableSortedTreeDictionary(this IEnumerable source, Func keySelector, Func elementSelector) + where TKey : notnull => ToImmutableSortedTreeDictionary(source, keySelector, elementSelector, keyComparer: null, valueComparer: null); - public static ImmutableSortedTreeDictionary ToImmutableSortedTreeDictionary(this IEnumerable source, Func keySelector, Func elementSelector, IComparer keyComparer) + public static ImmutableSortedTreeDictionary ToImmutableSortedTreeDictionary(this IEnumerable source, Func keySelector, Func elementSelector, IComparer? keyComparer) + where TKey : notnull => ToImmutableSortedTreeDictionary(source, keySelector, elementSelector, keyComparer, valueComparer: null); - public static ImmutableSortedTreeDictionary ToImmutableSortedTreeDictionary(this IEnumerable source, Func keySelector, Func elementSelector, IComparer keyComparer, IEqualityComparer valueComparer) + public static ImmutableSortedTreeDictionary ToImmutableSortedTreeDictionary(this IEnumerable source, Func keySelector, Func elementSelector, IComparer? keyComparer, IEqualityComparer? valueComparer) + where TKey : notnull { if (source is null) throw new ArgumentNullException(nameof(source)); diff --git a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeDictionary`2+Builder+ValueCollection.cs b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeDictionary`2+Builder+ValueCollection.cs index 5d9b358..8e94327 100644 --- a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeDictionary`2+Builder+ValueCollection.cs +++ b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeDictionary`2+Builder+ValueCollection.cs @@ -75,7 +75,7 @@ void ICollection.CopyTo(Array array, int index) { CopyTo(values, index); } - else if (array is object[] objects) + else if (array is object?[] objects) { try { diff --git a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeDictionary`2+Builder.cs b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeDictionary`2+Builder.cs index 7027d39..cfa5daa 100644 --- a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeDictionary`2+Builder.cs +++ b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeDictionary`2+Builder.cs @@ -6,6 +6,7 @@ namespace TunnelVisionLabs.Collections.Trees.Immutable using System; using System.Collections; using System.Collections.Generic; + using System.Diagnostics.CodeAnalysis; using System.Linq; public partial class ImmutableSortedTreeDictionary @@ -65,12 +66,12 @@ public TValue this[TKey key] set { - _treeSetBuilder.Remove(new KeyValuePair(key, default)); + _treeSetBuilder.Remove(new KeyValuePair(key, default!)); _treeSetBuilder.Add(new KeyValuePair(key, value)); } } - object IDictionary.this[object key] + object? IDictionary.this[object key] { get { @@ -97,7 +98,7 @@ object IDictionary.this[object key] var typedKey = (TKey)key; try { - this[typedKey] = (TValue)value; + this[typedKey] = (TValue)value!; } catch (InvalidCastException) { @@ -144,7 +145,7 @@ public bool Contains(KeyValuePair item) } public bool ContainsKey(TKey key) - => _treeSetBuilder.Contains(new KeyValuePair(key, default)); + => _treeSetBuilder.Contains(new KeyValuePair(key, default!)); public bool ContainsValue(TValue value) => _treeSetBuilder.Any(pair => ValueComparer.Equals(pair.Value, value)); @@ -152,8 +153,14 @@ public bool ContainsValue(TValue value) public Enumerator GetEnumerator() => new Enumerator(_treeSetBuilder.GetEnumerator(), Enumerator.ReturnType.KeyValuePair); + [return: MaybeNull] public TValue GetValueOrDefault(TKey key) - => GetValueOrDefault(key, default); + { + if (TryGetValue(key, out TValue value)) + return value; + + return default; + } public TValue GetValueOrDefault(TKey key, TValue defaultValue) { @@ -164,7 +171,7 @@ public TValue GetValueOrDefault(TKey key, TValue defaultValue) } public bool Remove(TKey key) - => _treeSetBuilder.Remove(new KeyValuePair(key, default)); + => _treeSetBuilder.Remove(new KeyValuePair(key, default!)); public bool Remove(KeyValuePair item) { @@ -182,13 +189,13 @@ public void RemoveRange(IEnumerable keys) if (keys is null) throw new ArgumentNullException(nameof(keys)); - _treeSetBuilder.ExceptWith(keys.Select(key => new KeyValuePair(key, default))); + _treeSetBuilder.ExceptWith(keys.Select(key => new KeyValuePair(key, default!))); } - public bool TryGetKey(TKey equalKey, out TKey actualKey) + public bool TryGetKey(TKey equalKey, [MaybeNullWhen(false)] out TKey actualKey) => ToImmutable().TryGetKey(equalKey, out actualKey); - public bool TryGetValue(TKey key, out TValue value) + public bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value) => ToImmutable().TryGetValue(key, out value); public ImmutableSortedTreeDictionary ToImmutable() @@ -222,7 +229,7 @@ bool IDictionary.Contains(object key) return key is TKey typedKey && ContainsKey(typedKey); } - void IDictionary.Add(object key, object value) + void IDictionary.Add(object key, object? value) { if (key == null) throw new ArgumentNullException(nameof(key)); @@ -234,7 +241,7 @@ void IDictionary.Add(object key, object value) var typedKey = (TKey)key; try { - Add(typedKey, (TValue)value); + Add(typedKey, (TValue)value!); } catch (InvalidCastException) { diff --git a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeDictionary`2+Enumerator.cs b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeDictionary`2+Enumerator.cs index e9ca4e3..4e360ca 100644 --- a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeDictionary`2+Enumerator.cs +++ b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeDictionary`2+Enumerator.cs @@ -45,7 +45,7 @@ internal enum ReturnType object IDictionaryEnumerator.Key => Current.Key; - object IDictionaryEnumerator.Value => Current.Value; + object? IDictionaryEnumerator.Value => Current.Value; public void Dispose() => _enumerator.Dispose(); diff --git a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeDictionary`2+ValueCollection+Enumerator.cs b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeDictionary`2+ValueCollection+Enumerator.cs index a376fa3..c05e5e6 100644 --- a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeDictionary`2+ValueCollection+Enumerator.cs +++ b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeDictionary`2+ValueCollection+Enumerator.cs @@ -21,7 +21,7 @@ internal Enumerator(ImmutableSortedTreeDictionary.Enumerator enume public TValue Current => _enumerator.Current.Value; - object IEnumerator.Current => Current; + object? IEnumerator.Current => Current; public void Dispose() => _enumerator.Dispose(); diff --git a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeDictionary`2+ValueCollection.cs b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeDictionary`2+ValueCollection.cs index 5e4beda..5c81f2c 100644 --- a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeDictionary`2+ValueCollection.cs +++ b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeDictionary`2+ValueCollection.cs @@ -70,7 +70,7 @@ void ICollection.CopyTo(Array array, int index) { ((ICollection)this).CopyTo(values, index); } - else if (array is object[] objects) + else if (array is object?[] objects) { try { diff --git a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeDictionary`2.cs b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeDictionary`2.cs index 7f2a861..bf11afc 100644 --- a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeDictionary`2.cs +++ b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeDictionary`2.cs @@ -8,9 +8,11 @@ namespace TunnelVisionLabs.Collections.Trees.Immutable using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics; + using System.Diagnostics.CodeAnalysis; using System.Linq; public sealed partial class ImmutableSortedTreeDictionary : IImmutableDictionary, IDictionary, IReadOnlyDictionary, IDictionary + where TKey : notnull { public static readonly ImmutableSortedTreeDictionary Empty = new ImmutableSortedTreeDictionary(ImmutableSortedTreeSet>.Empty.WithComparer(KeyOfPairComparer.Default), keyComparer: null, valueComparer: null); @@ -19,7 +21,7 @@ public static readonly ImmutableSortedTreeDictionary Empty private readonly IComparer _keyComparer; private readonly IEqualityComparer _valueComparer; - private ImmutableSortedTreeDictionary(ImmutableSortedTreeSet> treeSet, IComparer keyComparer, IEqualityComparer valueComparer) + private ImmutableSortedTreeDictionary(ImmutableSortedTreeSet> treeSet, IComparer? keyComparer, IEqualityComparer? valueComparer) { keyComparer = keyComparer ?? Comparer.Default; valueComparer = valueComparer ?? EqualityComparer.Default; @@ -71,7 +73,7 @@ public TValue this[TKey key] { get { - if (!_treeSet.TryGetValue(new KeyValuePair(key, default), out KeyValuePair value)) + if (!_treeSet.TryGetValue(new KeyValuePair(key, default!), out KeyValuePair value)) throw new KeyNotFoundException(); return value.Value; @@ -84,7 +86,7 @@ TValue IDictionary.this[TKey key] set => throw new NotSupportedException(); } - object IDictionary.this[object key] + object? IDictionary.this[object key] { get { @@ -143,7 +145,7 @@ public bool Contains(KeyValuePair pair) } public bool ContainsKey(TKey key) - => _treeSet.Contains(new KeyValuePair(key, default)); + => _treeSet.Contains(new KeyValuePair(key, default!)); public bool ContainsValue(TValue value) => _treeSet.Any(pair => ValueComparer.Equals(pair.Value, value)); @@ -153,7 +155,7 @@ public Enumerator GetEnumerator() public ImmutableSortedTreeDictionary Remove(TKey key) { - ImmutableSortedTreeSet> result = _treeSet.Remove(new KeyValuePair(key, default)); + ImmutableSortedTreeSet> result = _treeSet.Remove(new KeyValuePair(key, default!)); if (result == _treeSet) { return this; @@ -167,7 +169,7 @@ public ImmutableSortedTreeDictionary RemoveRange(IEnumerable if (keys is null) throw new ArgumentNullException(nameof(keys)); - ImmutableSortedTreeSet> result = _treeSet.Except(keys.Select(key => new KeyValuePair(key, default))); + ImmutableSortedTreeSet> result = _treeSet.Except(keys.Select(key => new KeyValuePair(key, default!))); if (result == _treeSet) { return this; @@ -193,9 +195,11 @@ public ImmutableSortedTreeDictionary SetItems(IEnumerable(equalKey, default), out KeyValuePair value)) + if (!_treeSet.TryGetValue(new KeyValuePair(equalKey, default!), out KeyValuePair value)) { actualKey = default; return false; @@ -205,9 +209,9 @@ public bool TryGetKey(TKey equalKey, out TKey actualKey) return true; } - public bool TryGetValue(TKey key, out TValue value) + public bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value) { - if (!_treeSet.TryGetValue(new KeyValuePair(key, default), out KeyValuePair actualValue)) + if (!_treeSet.TryGetValue(new KeyValuePair(key, default!), out KeyValuePair actualValue)) { value = default; return false; @@ -217,10 +221,10 @@ public bool TryGetValue(TKey key, out TValue value) return true; } - public ImmutableSortedTreeDictionary WithComparers(IComparer keyComparer) + public ImmutableSortedTreeDictionary WithComparers(IComparer? keyComparer) => WithComparers(keyComparer, valueComparer: null); - public ImmutableSortedTreeDictionary WithComparers(IComparer keyComparer, IEqualityComparer valueComparer) + public ImmutableSortedTreeDictionary WithComparers(IComparer? keyComparer, IEqualityComparer? valueComparer) { keyComparer = keyComparer ?? Comparer.Default; valueComparer = valueComparer ?? EqualityComparer.Default; @@ -354,7 +358,7 @@ void ICollection.CopyTo(Array array, int index) bool ICollection>.Remove(KeyValuePair item) => throw new NotSupportedException(); - void IDictionary.Add(object key, object value) => throw new NotSupportedException(); + void IDictionary.Add(object key, object? value) => throw new NotSupportedException(); void IDictionary.Clear() => throw new NotSupportedException(); diff --git a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeList.cs b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeList.cs index 1b6613b..6d546d2 100644 --- a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeList.cs +++ b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeList.cs @@ -16,31 +16,31 @@ public static ImmutableSortedTreeList Create(T item) public static ImmutableSortedTreeList Create(params T[] items) => ImmutableSortedTreeList.Empty.AddRange(items); - public static ImmutableSortedTreeList Create(IComparer comparer) + public static ImmutableSortedTreeList Create(IComparer? comparer) => ImmutableSortedTreeList.Empty.WithComparer(comparer); - public static ImmutableSortedTreeList Create(IComparer comparer, T item) + public static ImmutableSortedTreeList Create(IComparer? comparer, T item) => ImmutableSortedTreeList.Empty.WithComparer(comparer).Add(item); - public static ImmutableSortedTreeList Create(IComparer comparer, params T[] items) + public static ImmutableSortedTreeList Create(IComparer? comparer, params T[] items) => ImmutableSortedTreeList.Empty.WithComparer(comparer).AddRange(items); public static ImmutableSortedTreeList.Builder CreateBuilder() => Create().ToBuilder(); - public static ImmutableSortedTreeList.Builder CreateBuilder(IComparer comparer) + public static ImmutableSortedTreeList.Builder CreateBuilder(IComparer? comparer) => Create(comparer).ToBuilder(); public static ImmutableSortedTreeList CreateRange(IEnumerable items) => ImmutableSortedTreeList.Empty.AddRange(items); - public static ImmutableSortedTreeList CreateRange(IComparer comparer, IEnumerable items) + public static ImmutableSortedTreeList CreateRange(IComparer? comparer, IEnumerable items) => ImmutableSortedTreeList.Empty.WithComparer(comparer).AddRange(items); public static ImmutableSortedTreeList ToImmutableSortedTreeList(this IEnumerable source) => ToImmutableSortedTreeList(source, comparer: null); - public static ImmutableSortedTreeList ToImmutableSortedTreeList(this IEnumerable source, IComparer comparer) + public static ImmutableSortedTreeList ToImmutableSortedTreeList(this IEnumerable source, IComparer? comparer) => ImmutableSortedTreeList.Empty.WithComparer(comparer).AddRange(source); } } diff --git a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeList`1+Builder.cs b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeList`1+Builder.cs index 2b18634..37574d1 100644 --- a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeList`1+Builder.cs +++ b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeList`1+Builder.cs @@ -7,6 +7,7 @@ namespace TunnelVisionLabs.Collections.Trees.Immutable using System.Collections; using System.Collections.Generic; using System.Diagnostics; + using System.Diagnostics.CodeAnalysis; internal sealed partial class ImmutableSortedTreeList { @@ -43,7 +44,7 @@ T IList.this[int index] set => throw new NotSupportedException(); } - object IList.this[int index] + object? IList.this[int index] { get => this[index]; set => throw new NotSupportedException(); @@ -96,6 +97,7 @@ public void CopyTo(int index, T[] array, int arrayIndex, int count) public bool Exists(Predicate match) => FindIndex(match) >= 0; + [return: MaybeNull] public T Find(Predicate match) => _treeList.Find(match); @@ -111,6 +113,7 @@ public int FindIndex(int startIndex, Predicate match) public int FindIndex(int startIndex, int count, Predicate match) => _treeList.FindIndex(startIndex, count, match); + [return: MaybeNull] public T FindLast(Predicate match) => _treeList.FindLast(match); @@ -205,29 +208,30 @@ IEnumerator IEnumerable.GetEnumerator() IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); - int IList.Add(object value) + int IList.Add(object? value) { if (value == null && default(T) != null) throw new ArgumentNullException(nameof(value)); try { - Add((T)value); + Add((T)value!); } catch (InvalidCastException) { + Debug.Assert(value is object, $"Assertion failed: {nameof(value)} is object"); throw new ArgumentException(string.Format("The value \"{0}\" isn't of type \"{1}\" and can't be used in this generic collection.", value.GetType(), typeof(T)), nameof(value)); } return Count - 1; } - bool IList.Contains(object value) + bool IList.Contains(object? value) { if (value == null) { if (default(T) == null) - return Contains(default); + return Contains(default!); } else if (value is T) { @@ -237,12 +241,12 @@ bool IList.Contains(object value) return false; } - int IList.IndexOf(object value) + int IList.IndexOf(object? value) { if (value == null) { if (default(T) == null) - return IndexOf(default); + return IndexOf(default!); } else if (value is T) { @@ -252,7 +256,7 @@ int IList.IndexOf(object value) return -1; } - void IList.Remove(object value) + void IList.Remove(object? value) { int index = ((IList)this).IndexOf(value); if (index >= 0) @@ -267,7 +271,7 @@ void ICollection.CopyTo(Array array, int index) void IList.Insert(int index, T item) => throw new NotSupportedException(); - void IList.Insert(int index, object value) => throw new NotSupportedException(); + void IList.Insert(int index, object? value) => throw new NotSupportedException(); internal void TrimExcess() => _treeList.TrimExcess(); diff --git a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeList`1+Enumerator.cs b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeList`1+Enumerator.cs index ff1d6fc..8a03e38 100644 --- a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeList`1+Enumerator.cs +++ b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeList`1+Enumerator.cs @@ -19,7 +19,7 @@ internal Enumerator(ImmutableTreeList.Enumerator enumerator) public T Current => _enumerator.Current; - object IEnumerator.Current => Current; + object? IEnumerator.Current => Current; public void Dispose() => _enumerator.Dispose(); diff --git a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeList`1.cs b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeList`1.cs index 0b8549e..110a6fd 100644 --- a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeList`1.cs +++ b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeList`1.cs @@ -8,6 +8,7 @@ namespace TunnelVisionLabs.Collections.Trees.Immutable using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics; + using System.Diagnostics.CodeAnalysis; internal sealed partial class ImmutableSortedTreeList : IImmutableList, IReadOnlyList, IList, IList { @@ -46,7 +47,7 @@ T IList.this[int index] set => throw new NotSupportedException(); } - object IList.this[int index] + object? IList.this[int index] { get => this[index]; set => throw new NotSupportedException(); @@ -113,6 +114,7 @@ public void CopyTo(int index, T[] array, int arrayIndex, int count) public bool Exists(Predicate match) => _treeList.Exists(match); + [return: MaybeNull] public T Find(Predicate match) => _treeList.Find(match); @@ -136,6 +138,7 @@ public int FindIndex(int startIndex, Predicate match) public int FindIndex(int startIndex, int count, Predicate match) => _treeList.FindIndex(startIndex, count, match); + [return: MaybeNull] public T FindLast(Predicate match) => _treeList.FindLast(match); @@ -181,7 +184,7 @@ public int IndexOf(T value, int index, int count) return ~result; } - int IImmutableList.IndexOf(T value, int index, int count, IEqualityComparer equalityComparer) + int IImmutableList.IndexOf(T value, int index, int count, IEqualityComparer? equalityComparer) => _treeList.IndexOf(value, index, count, equalityComparer); public int LastIndexOf(T item) @@ -205,7 +208,7 @@ public int LastIndexOf(T item, int index, int count) return ~result - 1; } - int IImmutableList.LastIndexOf(T item, int index, int count, IEqualityComparer equalityComparer) + int IImmutableList.LastIndexOf(T item, int index, int count, IEqualityComparer? equalityComparer) => _treeList.LastIndexOf(item, index, count, equalityComparer); public ImmutableSortedTreeList Remove(T value) @@ -270,7 +273,7 @@ public ImmutableSortedTreeList Replace(T oldValue, T newValue) public IEnumerable Reverse() => _treeList.Reverse(); - public ImmutableSortedTreeList WithComparer(IComparer comparer) + public ImmutableSortedTreeList WithComparer(IComparer? comparer) { comparer = comparer ?? Comparer.Default; if (comparer == _comparer) @@ -294,7 +297,7 @@ IImmutableList IImmutableList.Add(T value) IImmutableList IImmutableList.AddRange(IEnumerable items) => AddRange(items); - IImmutableList IImmutableList.Remove(T value, IEqualityComparer equalityComparer) + IImmutableList IImmutableList.Remove(T value, IEqualityComparer? equalityComparer) { int index = ((IImmutableList)this).IndexOf(value, 0, Count, equalityComparer); if (index < 0) @@ -306,7 +309,7 @@ IImmutableList IImmutableList.Remove(T value, IEqualityComparer equalit IImmutableList IImmutableList.RemoveAll(Predicate match) => RemoveAll(match); - IImmutableList IImmutableList.RemoveRange(IEnumerable items, IEqualityComparer equalityComparer) + IImmutableList IImmutableList.RemoveRange(IEnumerable items, IEqualityComparer? equalityComparer) { if (items is null) throw new ArgumentNullException(nameof(items)); @@ -326,7 +329,7 @@ IImmutableList IImmutableList.RemoveRange(int index, int count) IImmutableList IImmutableList.RemoveAt(int index) => RemoveAt(index); - IImmutableList IImmutableList.Replace(T oldValue, T newValue, IEqualityComparer equalityComparer) + IImmutableList IImmutableList.Replace(T oldValue, T newValue, IEqualityComparer? equalityComparer) { int index = ((IImmutableList)this).IndexOf(oldValue, 0, Count, equalityComparer); if (index < 0) @@ -341,12 +344,12 @@ IEnumerator IEnumerable.GetEnumerator() IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); - bool IList.Contains(object value) + bool IList.Contains(object? value) { if (value == null) { if (default(T) == null) - return Contains(default); + return Contains(default!); } else if (value is T) { @@ -356,12 +359,12 @@ bool IList.Contains(object value) return false; } - int IList.IndexOf(object value) + int IList.IndexOf(object? value) { if (value == null) { if (default(T) == null) - return IndexOf(default); + return IndexOf(default!); } else if (value is T) { @@ -393,13 +396,13 @@ void ICollection.CopyTo(Array array, int index) bool ICollection.Remove(T item) => throw new NotSupportedException(); - int IList.Add(object value) => throw new NotSupportedException(); + int IList.Add(object? value) => throw new NotSupportedException(); void IList.Clear() => throw new NotSupportedException(); - void IList.Insert(int index, object value) => throw new NotSupportedException(); + void IList.Insert(int index, object? value) => throw new NotSupportedException(); - void IList.Remove(object value) => throw new NotSupportedException(); + void IList.Remove(object? value) => throw new NotSupportedException(); void IList.RemoveAt(int index) => throw new NotSupportedException(); @@ -431,7 +434,7 @@ public CoercingComparer(IComparer underlyingComparer, int coerceResult) public bool FoundMatch => _foundMatch; - public int Compare(T x, T y) + public int Compare([AllowNull] T x, [AllowNull] T y) { int result = _underlyingComparer.Compare(x, y); if (result != 0) diff --git a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeSet.cs b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeSet.cs index 4efddca..b28b316 100644 --- a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeSet.cs +++ b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeSet.cs @@ -17,31 +17,31 @@ public static ImmutableSortedTreeSet Create(T item) public static ImmutableSortedTreeSet Create(params T[] items) => ImmutableSortedTreeSet.Empty.Union(items); - public static ImmutableSortedTreeSet Create(IComparer comparer) + public static ImmutableSortedTreeSet Create(IComparer? comparer) => ImmutableSortedTreeSet.Empty.WithComparer(comparer); - public static ImmutableSortedTreeSet Create(IComparer comparer, T item) + public static ImmutableSortedTreeSet Create(IComparer? comparer, T item) => ImmutableSortedTreeSet.Empty.WithComparer(comparer).Add(item); - public static ImmutableSortedTreeSet Create(IComparer comparer, params T[] items) + public static ImmutableSortedTreeSet Create(IComparer? comparer, params T[] items) => ImmutableSortedTreeSet.Empty.WithComparer(comparer).Union(items); public static ImmutableSortedTreeSet.Builder CreateBuilder() => Create().ToBuilder(); - public static ImmutableSortedTreeSet.Builder CreateBuilder(IComparer comparer) + public static ImmutableSortedTreeSet.Builder CreateBuilder(IComparer? comparer) => Create(comparer).ToBuilder(); public static ImmutableSortedTreeSet CreateRange(IEnumerable items) => ImmutableSortedTreeSet.Empty.Union(items); - public static ImmutableSortedTreeSet CreateRange(IComparer comparer, IEnumerable items) + public static ImmutableSortedTreeSet CreateRange(IComparer? comparer, IEnumerable items) => ImmutableSortedTreeSet.Empty.WithComparer(comparer).Union(items); public static ImmutableSortedTreeSet ToImmutableSortedTreeSet(this IEnumerable source) => ToImmutableSortedTreeSet(source, comparer: null); - public static ImmutableSortedTreeSet ToImmutableSortedTreeSet(this IEnumerable source, IComparer comparer) + public static ImmutableSortedTreeSet ToImmutableSortedTreeSet(this IEnumerable source, IComparer? comparer) { if (source is null) throw new ArgumentNullException(nameof(source)); diff --git a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeSet`1+Builder.cs b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeSet`1+Builder.cs index c357a55..3365917 100644 --- a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeSet`1+Builder.cs +++ b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeSet`1+Builder.cs @@ -7,6 +7,7 @@ namespace TunnelVisionLabs.Collections.Trees.Immutable using System.Collections; using System.Collections.Generic; using System.Diagnostics; + using System.Diagnostics.CodeAnalysis; using System.Linq; public partial class ImmutableSortedTreeSet @@ -26,8 +27,10 @@ internal Builder(ImmutableSortedTreeSet immutableSet) public int Count => _sortedList.Count; + [MaybeNull] public T Max => Count > 0 ? this[Count - 1] : default; + [MaybeNull] public T Min => Count > 0 ? this[0] : default; bool ICollection.IsReadOnly => false; @@ -392,7 +395,7 @@ public void UnionWith(IEnumerable other) internal void TrimExcess() => _sortedList.TrimExcess(); - internal bool TryGetValue(T equalValue, out T actualValue) + internal bool TryGetValue(T equalValue, [MaybeNullWhen(false)] out T actualValue) { int index = _sortedList.BinarySearch(equalValue); if (index < 0) diff --git a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeSet`1+Enumerator.cs b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeSet`1+Enumerator.cs index a2301a9..4afebdf 100644 --- a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeSet`1+Enumerator.cs +++ b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeSet`1+Enumerator.cs @@ -19,7 +19,7 @@ internal Enumerator(ImmutableSortedTreeList.Enumerator enumerator) public T Current => _enumerator.Current; - object IEnumerator.Current => Current; + object? IEnumerator.Current => Current; public void Dispose() => _enumerator.Dispose(); diff --git a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeSet`1.cs b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeSet`1.cs index d5ee63a..b8e6740 100644 --- a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeSet`1.cs +++ b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableSortedTreeSet`1.cs @@ -7,6 +7,7 @@ namespace TunnelVisionLabs.Collections.Trees.Immutable using System.Collections; using System.Collections.Generic; using System.Collections.Immutable; + using System.Diagnostics.CodeAnalysis; public sealed partial class ImmutableSortedTreeSet : IImmutableSet, ISet, IList, IReadOnlyList, IList { @@ -25,8 +26,10 @@ private ImmutableSortedTreeSet(ImmutableSortedTreeList sortedList) public bool IsEmpty => _sortedList.IsEmpty; + [MaybeNull] public T Max => !IsEmpty ? this[Count - 1] : default; + [MaybeNull] public T Min => !IsEmpty ? this[0] : default; bool ICollection.IsReadOnly => true; @@ -47,7 +50,7 @@ T IList.this[int index] set => throw new NotSupportedException(); } - object IList.this[int index] + object? IList.this[int index] { get => _sortedList[index]; set => throw new NotSupportedException(); @@ -126,7 +129,9 @@ public ImmutableSortedTreeSet SymmetricExcept(IEnumerable other) return builder.ToImmutable(); } - public bool TryGetValue(T equalValue, out T actualValue) +#pragma warning disable CS8767 // Nullability of reference types in type of parameter doesn't match implicitly implemented member (possibly because of nullability attributes). + public bool TryGetValue(T equalValue, [MaybeNullWhen(false)] out T actualValue) +#pragma warning restore CS8767 // Nullability of reference types in type of parameter doesn't match implicitly implemented member (possibly because of nullability attributes). => ToBuilder().TryGetValue(equalValue, out actualValue); public ImmutableSortedTreeSet Union(IEnumerable other) @@ -139,7 +144,7 @@ public ImmutableSortedTreeSet Union(IEnumerable other) public Builder ToBuilder() => new Builder(this); - public ImmutableSortedTreeSet WithComparer(IComparer comparer) + public ImmutableSortedTreeSet WithComparer(IComparer? comparer) { comparer = comparer ?? Comparer.Default; if (comparer == _sortedList.Comparer) @@ -189,13 +194,13 @@ void ICollection.CopyTo(Array array, int index) collection.CopyTo(array, index); } - bool IList.Contains(object value) + bool IList.Contains(object? value) { IList sortedList = _sortedList; return sortedList.Contains(value); } - int IList.IndexOf(object value) + int IList.IndexOf(object? value) { IList sortedList = _sortedList; return sortedList.IndexOf(value); @@ -227,13 +232,13 @@ IEnumerator IEnumerable.GetEnumerator() void IList.RemoveAt(int index) => throw new NotSupportedException(); - int IList.Add(object value) => throw new NotSupportedException(); + int IList.Add(object? value) => throw new NotSupportedException(); void IList.Clear() => throw new NotSupportedException(); - void IList.Insert(int index, object value) => throw new NotSupportedException(); + void IList.Insert(int index, object? value) => throw new NotSupportedException(); - void IList.Remove(object value) => throw new NotSupportedException(); + void IList.Remove(object? value) => throw new NotSupportedException(); void IList.RemoveAt(int index) => throw new NotSupportedException(); diff --git a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeDictionary.cs b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeDictionary.cs index 63dcfdc..8ad40d3 100644 --- a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeDictionary.cs +++ b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeDictionary.cs @@ -10,39 +10,51 @@ namespace TunnelVisionLabs.Collections.Trees.Immutable public static class ImmutableTreeDictionary { public static ImmutableTreeDictionary Create() + where TKey : notnull => ImmutableTreeDictionary.Empty; - public static ImmutableTreeDictionary Create(IEqualityComparer keyComparer) + public static ImmutableTreeDictionary Create(IEqualityComparer? keyComparer) + where TKey : notnull => ImmutableTreeDictionary.Empty.WithComparers(keyComparer); - public static ImmutableTreeDictionary Create(IEqualityComparer keyComparer, IEqualityComparer valueComparer) + public static ImmutableTreeDictionary Create(IEqualityComparer? keyComparer, IEqualityComparer? valueComparer) + where TKey : notnull => ImmutableTreeDictionary.Empty.WithComparers(keyComparer, valueComparer); public static ImmutableTreeDictionary.Builder CreateBuilder() + where TKey : notnull => Create().ToBuilder(); - public static ImmutableTreeDictionary.Builder CreateBuilder(IEqualityComparer keyComparer) + public static ImmutableTreeDictionary.Builder CreateBuilder(IEqualityComparer? keyComparer) + where TKey : notnull => Create(keyComparer).ToBuilder(); - public static ImmutableTreeDictionary.Builder CreateBuilder(IEqualityComparer keyComparer, IEqualityComparer valueComparer) + public static ImmutableTreeDictionary.Builder CreateBuilder(IEqualityComparer? keyComparer, IEqualityComparer? valueComparer) + where TKey : notnull => Create(keyComparer, valueComparer).ToBuilder(); public static ImmutableTreeDictionary CreateRange(IEnumerable> items) + where TKey : notnull => ImmutableTreeDictionary.Empty.AddRange(items); - public static ImmutableTreeDictionary CreateRange(IEqualityComparer keyComparer, IEnumerable> items) + public static ImmutableTreeDictionary CreateRange(IEqualityComparer? keyComparer, IEnumerable> items) + where TKey : notnull => ImmutableTreeDictionary.Empty.WithComparers(keyComparer).AddRange(items); - public static ImmutableTreeDictionary CreateRange(IEqualityComparer keyComparer, IEqualityComparer valueComparer, IEnumerable> items) + public static ImmutableTreeDictionary CreateRange(IEqualityComparer? keyComparer, IEqualityComparer? valueComparer, IEnumerable> items) + where TKey : notnull => ImmutableTreeDictionary.Empty.WithComparers(keyComparer, valueComparer).AddRange(items); public static ImmutableTreeDictionary ToImmutableTreeDictionary(this IEnumerable> items) + where TKey : notnull => ToImmutableTreeDictionary(items, keyComparer: null, valueComparer: null); - public static ImmutableTreeDictionary ToImmutableTreeDictionary(this IEnumerable> items, IEqualityComparer keyComparer) + public static ImmutableTreeDictionary ToImmutableTreeDictionary(this IEnumerable> items, IEqualityComparer? keyComparer) + where TKey : notnull => ToImmutableTreeDictionary(items, keyComparer, valueComparer: null); - public static ImmutableTreeDictionary ToImmutableTreeDictionary(this IEnumerable> items, IEqualityComparer keyComparer, IEqualityComparer valueComparer) + public static ImmutableTreeDictionary ToImmutableTreeDictionary(this IEnumerable> items, IEqualityComparer? keyComparer, IEqualityComparer? valueComparer) + where TKey : notnull { if (items is null) throw new ArgumentNullException(nameof(items)); @@ -54,12 +66,15 @@ public static ImmutableTreeDictionary ToImmutableTreeDictionary ToImmutableTreeDictionary(this IEnumerable source, Func keySelector, Func elementSelector) + where TKey : notnull => ToImmutableTreeDictionary(source, keySelector, elementSelector, keyComparer: null, valueComparer: null); - public static ImmutableTreeDictionary ToImmutableTreeDictionary(this IEnumerable source, Func keySelector, Func elementSelector, IEqualityComparer keyComparer) + public static ImmutableTreeDictionary ToImmutableTreeDictionary(this IEnumerable source, Func keySelector, Func elementSelector, IEqualityComparer? keyComparer) + where TKey : notnull => ToImmutableTreeDictionary(source, keySelector, elementSelector, keyComparer, valueComparer: null); - public static ImmutableTreeDictionary ToImmutableTreeDictionary(this IEnumerable source, Func keySelector, Func elementSelector, IEqualityComparer keyComparer, IEqualityComparer valueComparer) + public static ImmutableTreeDictionary ToImmutableTreeDictionary(this IEnumerable source, Func keySelector, Func elementSelector, IEqualityComparer? keyComparer, IEqualityComparer? valueComparer) + where TKey : notnull { if (source is null) throw new ArgumentNullException(nameof(source)); @@ -73,9 +88,11 @@ public static ImmutableTreeDictionary ToImmutableTreeDictionary ToImmutableTreeDictionary(this IEnumerable source, Func keySelector) + where TKey : notnull => ToImmutableTreeDictionary(source, keySelector, elementSelector: x => x, keyComparer: null, valueComparer: null); - public static ImmutableTreeDictionary ToImmutableTreeDictionary(this IEnumerable source, Func keySelector, IEqualityComparer keyComparer) + public static ImmutableTreeDictionary ToImmutableTreeDictionary(this IEnumerable source, Func keySelector, IEqualityComparer? keyComparer) + where TKey : notnull => ToImmutableTreeDictionary(source, keySelector, elementSelector: x => x, keyComparer, valueComparer: null); } } diff --git a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeDictionary`2+Builder+ValueCollection.cs b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeDictionary`2+Builder+ValueCollection.cs index 2b6f96c..b09dc94 100644 --- a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeDictionary`2+Builder+ValueCollection.cs +++ b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeDictionary`2+Builder+ValueCollection.cs @@ -75,7 +75,7 @@ void ICollection.CopyTo(Array array, int index) { CopyTo(values, index); } - else if (array is object[] objects) + else if (array is object?[] objects) { try { diff --git a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeDictionary`2+Builder.cs b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeDictionary`2+Builder.cs index 08e85a0..4d65ab4 100644 --- a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeDictionary`2+Builder.cs +++ b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeDictionary`2+Builder.cs @@ -6,6 +6,7 @@ namespace TunnelVisionLabs.Collections.Trees.Immutable using System; using System.Collections; using System.Collections.Generic; + using System.Diagnostics.CodeAnalysis; using System.Linq; public partial class ImmutableTreeDictionary @@ -65,12 +66,12 @@ public TValue this[TKey key] set { - _treeSetBuilder.Remove(new KeyValuePair(key, default)); + _treeSetBuilder.Remove(new KeyValuePair(key, default!)); _treeSetBuilder.Add(new KeyValuePair(key, value)); } } - object IDictionary.this[object key] + object? IDictionary.this[object key] { get { @@ -97,7 +98,7 @@ object IDictionary.this[object key] var typedKey = (TKey)key; try { - this[typedKey] = (TValue)value; + this[typedKey] = (TValue)value!; } catch (InvalidCastException) { @@ -144,7 +145,7 @@ public bool Contains(KeyValuePair item) } public bool ContainsKey(TKey key) - => _treeSetBuilder.Contains(new KeyValuePair(key, default)); + => _treeSetBuilder.Contains(new KeyValuePair(key, default!)); public bool ContainsValue(TValue value) => _treeSetBuilder.Any(pair => ValueComparer.Equals(pair.Value, value)); @@ -152,8 +153,14 @@ public bool ContainsValue(TValue value) public Enumerator GetEnumerator() => new Enumerator(_treeSetBuilder.GetEnumerator(), Enumerator.ReturnType.KeyValuePair); + [return: MaybeNull] public TValue GetValueOrDefault(TKey key) - => GetValueOrDefault(key, default); + { + if (TryGetValue(key, out TValue value)) + return value; + + return default; + } public TValue GetValueOrDefault(TKey key, TValue defaultValue) { @@ -164,7 +171,7 @@ public TValue GetValueOrDefault(TKey key, TValue defaultValue) } public bool Remove(TKey key) - => _treeSetBuilder.Remove(new KeyValuePair(key, default)); + => _treeSetBuilder.Remove(new KeyValuePair(key, default!)); public bool Remove(KeyValuePair item) { @@ -182,13 +189,13 @@ public void RemoveRange(IEnumerable keys) if (keys is null) throw new ArgumentNullException(nameof(keys)); - _treeSetBuilder.ExceptWith(keys.Select(key => new KeyValuePair(key, default))); + _treeSetBuilder.ExceptWith(keys.Select(key => new KeyValuePair(key, default!))); } - public bool TryGetKey(TKey equalKey, out TKey actualKey) + public bool TryGetKey(TKey equalKey, [MaybeNullWhen(false)] out TKey actualKey) => ToImmutable().TryGetKey(equalKey, out actualKey); - public bool TryGetValue(TKey key, out TValue value) + public bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value) => ToImmutable().TryGetValue(key, out value); public ImmutableTreeDictionary ToImmutable() @@ -222,7 +229,7 @@ bool IDictionary.Contains(object key) return key is TKey typedKey && ContainsKey(typedKey); } - void IDictionary.Add(object key, object value) + void IDictionary.Add(object key, object? value) { if (key == null) throw new ArgumentNullException(nameof(key)); @@ -234,7 +241,7 @@ void IDictionary.Add(object key, object value) var typedKey = (TKey)key; try { - Add(typedKey, (TValue)value); + Add(typedKey, (TValue)value!); } catch (InvalidCastException) { diff --git a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeDictionary`2+Enumerator.cs b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeDictionary`2+Enumerator.cs index f673d48..024d10a 100644 --- a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeDictionary`2+Enumerator.cs +++ b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeDictionary`2+Enumerator.cs @@ -45,7 +45,7 @@ internal enum ReturnType object IDictionaryEnumerator.Key => Current.Key; - object IDictionaryEnumerator.Value => Current.Value; + object? IDictionaryEnumerator.Value => Current.Value; public void Dispose() => _enumerator.Dispose(); diff --git a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeDictionary`2+ValueCollection+Enumerator.cs b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeDictionary`2+ValueCollection+Enumerator.cs index 30e0893..60135c6 100644 --- a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeDictionary`2+ValueCollection+Enumerator.cs +++ b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeDictionary`2+ValueCollection+Enumerator.cs @@ -21,7 +21,7 @@ internal Enumerator(ImmutableTreeDictionary.Enumerator enumerator) public TValue Current => _enumerator.Current.Value; - object IEnumerator.Current => Current; + object? IEnumerator.Current => Current; public void Dispose() => _enumerator.Dispose(); diff --git a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeDictionary`2+ValueCollection.cs b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeDictionary`2+ValueCollection.cs index cc8898d..20743c6 100644 --- a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeDictionary`2+ValueCollection.cs +++ b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeDictionary`2+ValueCollection.cs @@ -70,7 +70,7 @@ void ICollection.CopyTo(Array array, int index) { ((ICollection)this).CopyTo(values, index); } - else if (array is object[] objects) + else if (array is object?[] objects) { try { diff --git a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeDictionary`2.cs b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeDictionary`2.cs index ae8b170..c3f2747 100644 --- a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeDictionary`2.cs +++ b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeDictionary`2.cs @@ -8,9 +8,11 @@ namespace TunnelVisionLabs.Collections.Trees.Immutable using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics; + using System.Diagnostics.CodeAnalysis; using System.Linq; public sealed partial class ImmutableTreeDictionary : IImmutableDictionary, IDictionary, IReadOnlyDictionary, IDictionary + where TKey : notnull { public static readonly ImmutableTreeDictionary Empty = new ImmutableTreeDictionary(); @@ -24,7 +26,7 @@ private ImmutableTreeDictionary() { } - private ImmutableTreeDictionary(ImmutableTreeSet> treeSet, IEqualityComparer keyComparer, IEqualityComparer valueComparer) + private ImmutableTreeDictionary(ImmutableTreeSet> treeSet, IEqualityComparer? keyComparer, IEqualityComparer? valueComparer) { keyComparer = keyComparer ?? EqualityComparer.Default; valueComparer = valueComparer ?? EqualityComparer.Default; @@ -76,7 +78,7 @@ public TValue this[TKey key] { get { - if (!_treeSet.TryGetValue(new KeyValuePair(key, default), out KeyValuePair value)) + if (!_treeSet.TryGetValue(new KeyValuePair(key, default!), out KeyValuePair value)) throw new KeyNotFoundException(); return value.Value; @@ -89,7 +91,7 @@ TValue IDictionary.this[TKey key] set => throw new NotSupportedException(); } - object IDictionary.this[object key] + object? IDictionary.this[object key] { get { @@ -148,7 +150,7 @@ public bool Contains(KeyValuePair pair) } public bool ContainsKey(TKey key) - => _treeSet.Contains(new KeyValuePair(key, default)); + => _treeSet.Contains(new KeyValuePair(key, default!)); public bool ContainsValue(TValue value) => _treeSet.Any(pair => ValueComparer.Equals(pair.Value, value)); @@ -158,7 +160,7 @@ public Enumerator GetEnumerator() public ImmutableTreeDictionary Remove(TKey key) { - ImmutableTreeSet> result = _treeSet.Remove(new KeyValuePair(key, default)); + ImmutableTreeSet> result = _treeSet.Remove(new KeyValuePair(key, default!)); if (result == _treeSet) { return this; @@ -172,7 +174,7 @@ public ImmutableTreeDictionary RemoveRange(IEnumerable keys) if (keys is null) throw new ArgumentNullException(nameof(keys)); - ImmutableTreeSet> result = _treeSet.Except(keys.Select(key => new KeyValuePair(key, default))); + ImmutableTreeSet> result = _treeSet.Except(keys.Select(key => new KeyValuePair(key, default!))); if (result == _treeSet) { return this; @@ -198,9 +200,11 @@ public ImmutableTreeDictionary SetItems(IEnumerable(equalKey, default), out KeyValuePair value)) + if (!_treeSet.TryGetValue(new KeyValuePair(equalKey, default!), out KeyValuePair value)) { actualKey = default; return false; @@ -210,9 +214,9 @@ public bool TryGetKey(TKey equalKey, out TKey actualKey) return true; } - public bool TryGetValue(TKey key, out TValue value) + public bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value) { - if (!_treeSet.TryGetValue(new KeyValuePair(key, default), out KeyValuePair actualValue)) + if (!_treeSet.TryGetValue(new KeyValuePair(key, default!), out KeyValuePair actualValue)) { value = default; return false; @@ -222,10 +226,10 @@ public bool TryGetValue(TKey key, out TValue value) return true; } - public ImmutableTreeDictionary WithComparers(IEqualityComparer keyComparer) + public ImmutableTreeDictionary WithComparers(IEqualityComparer? keyComparer) => WithComparers(keyComparer, valueComparer: null); - public ImmutableTreeDictionary WithComparers(IEqualityComparer keyComparer, IEqualityComparer valueComparer) + public ImmutableTreeDictionary WithComparers(IEqualityComparer? keyComparer, IEqualityComparer? valueComparer) { keyComparer = keyComparer ?? EqualityComparer.Default; valueComparer = valueComparer ?? EqualityComparer.Default; @@ -359,7 +363,7 @@ void ICollection.CopyTo(Array array, int index) bool ICollection>.Remove(KeyValuePair item) => throw new NotSupportedException(); - void IDictionary.Add(object key, object value) => throw new NotSupportedException(); + void IDictionary.Add(object key, object? value) => throw new NotSupportedException(); void IDictionary.Clear() => throw new NotSupportedException(); diff --git a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeList`1+Builder.cs b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeList`1+Builder.cs index 4687858..c93a062 100644 --- a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeList`1+Builder.cs +++ b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeList`1+Builder.cs @@ -7,6 +7,7 @@ namespace TunnelVisionLabs.Collections.Trees.Immutable using System.Collections; using System.Collections.Generic; using System.Diagnostics; + using System.Diagnostics.CodeAnalysis; using System.Linq; public partial class ImmutableTreeList @@ -61,7 +62,7 @@ public T this[int index] } } - object IList.this[int index] + object? IList.this[int index] { get { @@ -80,10 +81,11 @@ object IList.this[int index] try { - this[index] = (T)value; + this[index] = (T)value!; } catch (InvalidCastException) { + Debug.Assert(value is object, $"Assertion failed: {nameof(value)} is object"); throw new ArgumentException($"The value \"{value.GetType()}\" isn't of type \"{typeof(T)}\" and can't be used in this generic collection.", nameof(value)); } } @@ -105,9 +107,9 @@ public void AddRange(IEnumerable items) public int BinarySearch(T item) => BinarySearch(0, Count, item, comparer: null); - public int BinarySearch(T item, IComparer comparer) => BinarySearch(0, Count, item, comparer); + public int BinarySearch(T item, IComparer? comparer) => BinarySearch(0, Count, item, comparer); - public int BinarySearch(int index, int count, T item, IComparer comparer) + public int BinarySearch(int index, int count, T item, IComparer? comparer) { if (index < 0) throw new ArgumentOutOfRangeException(nameof(index)); @@ -164,6 +166,7 @@ public void CopyTo(int index, T[] array, int arrayIndex, int count) public bool Exists(Predicate match) => FindIndex(match) >= 0; + [return: MaybeNull] public T Find(Predicate match) { if (match == null) @@ -204,6 +207,7 @@ public int FindIndex(int startIndex, int count, Predicate match) return _root.FindIndex(new TreeSpan(startIndex, count), match); } + [return: MaybeNull] public T FindLast(Predicate match) { int index = FindLastIndex(match); @@ -260,7 +264,7 @@ public void ForEach(Action action) public int IndexOf(T item, int index, int count) => IndexOf(item, index, count, equalityComparer: null); - public int IndexOf(T item, int index, int count, IEqualityComparer equalityComparer) + public int IndexOf(T item, int index, int count, IEqualityComparer? equalityComparer) { if (index < 0) throw new ArgumentOutOfRangeException(nameof(index)); @@ -290,7 +294,7 @@ public void InsertRange(int index, IEnumerable items) public int LastIndexOf(T item, int startIndex, int count) => LastIndexOf(item, startIndex, count, equalityComparer: null); - public int LastIndexOf(T item, int startIndex, int count, IEqualityComparer equalityComparer) + public int LastIndexOf(T item, int startIndex, int count, IEqualityComparer? equalityComparer) { if (Count == 0) { @@ -368,7 +372,7 @@ public void Reverse(int index, int count) public void Sort() => Sort(0, Count, comparer: null); - public void Sort(IComparer comparer) => Sort(0, Count, comparer); + public void Sort(IComparer? comparer) => Sort(0, Count, comparer); public void Sort(Comparison comparison) { @@ -378,7 +382,7 @@ public void Sort(Comparison comparison) Sort(0, Count, new ComparisonComparer(comparison)); } - public void Sort(int index, int count, IComparer comparer) + public void Sort(int index, int count, IComparer? comparer) { if (index < 0) throw new ArgumentOutOfRangeException(nameof(index)); @@ -420,29 +424,30 @@ public bool TrueForAll(Predicate match) IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); - int IList.Add(object value) + int IList.Add(object? value) { if (value == null && default(T) != null) throw new ArgumentNullException(nameof(value)); try { - Add((T)value); + Add((T)value!); } catch (InvalidCastException) { + Debug.Assert(value is object, $"Assertion failed: {nameof(value)} is object"); throw new ArgumentException($"The value \"{value.GetType()}\" isn't of type \"{typeof(T)}\" and can't be used in this generic collection.", nameof(value)); } return Count - 1; } - bool IList.Contains(object value) + bool IList.Contains(object? value) { if (value == null) { if (default(T) == null) - return Contains(default); + return Contains(default!); } else if (value is T) { @@ -452,12 +457,12 @@ bool IList.Contains(object value) return false; } - int IList.IndexOf(object value) + int IList.IndexOf(object? value) { if (value == null) { if (default(T) == null) - return IndexOf(default); + return IndexOf(default!); } else if (value is T) { @@ -467,7 +472,7 @@ int IList.IndexOf(object value) return -1; } - void IList.Insert(int index, object value) + void IList.Insert(int index, object? value) { if (value == null && default(T) != null) throw new ArgumentNullException(nameof(value)); @@ -476,15 +481,16 @@ void IList.Insert(int index, object value) try { - Insert(index, (T)value); + Insert(index, (T)value!); } catch (InvalidCastException) { + Debug.Assert(value is object, $"Assertion failed: {nameof(value)} is object"); throw new ArgumentException(string.Format("The value \"{0}\" isn't of type \"{1}\" and can't be used in this generic collection.", value.GetType(), typeof(T)), nameof(value)); } } - void IList.Remove(object value) + void IList.Remove(object? value) { int index = ((IList)this).IndexOf(value); if (index >= 0) @@ -505,7 +511,7 @@ void ICollection.CopyTo(Array array, int index) throw new ArgumentOutOfRangeException("Not enough space is available in the destination array.", nameof(index)); int offset = index; - LeafNode leaf = _root.FirstLeaf; + LeafNode? leaf = _root.FirstLeaf; while (leaf != null) { leaf.CopyToArray(array, offset); diff --git a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeList`1+Enumerator.cs b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeList`1+Enumerator.cs index b52e329..4087848 100644 --- a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeList`1+Enumerator.cs +++ b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeList`1+Enumerator.cs @@ -14,11 +14,11 @@ public struct Enumerator : IEnumerator private readonly Node _root; private readonly TreeSpan _span; - private readonly Builder _builder; + private readonly Builder? _builder; private readonly int _version; private int _index; - private LeafNode _leafNode; + private LeafNode? _leafNode; private int _leafIndex; private T _current; @@ -27,12 +27,12 @@ internal Enumerator(ImmutableTreeList list) { } - internal Enumerator(ImmutableTreeList list, Builder builder) + internal Enumerator(ImmutableTreeList list, Builder? builder) : this(list, list._root.Span, builder) { } - internal Enumerator(ImmutableTreeList list, TreeSpan span, Builder builder) + internal Enumerator(ImmutableTreeList list, TreeSpan span, Builder? builder) { _root = list._root; _span = span; @@ -41,12 +41,12 @@ internal Enumerator(ImmutableTreeList list, TreeSpan span, Builder builder) _index = -1; _leafNode = null; _leafIndex = -1; - _current = default; + _current = default!; } public T Current => _current; - object IEnumerator.Current => Current; + object? IEnumerator.Current => Current; public void Dispose() { @@ -78,7 +78,7 @@ public bool MoveNext() _index = _span.Start - 1; _leafIndex--; } - else if (_leafIndex == _leafNode.Count - 1) + else if (_leafIndex == _leafNode!.Count - 1) { if (_index == _root.Count - 1) { @@ -103,7 +103,7 @@ public bool MoveNext() } _leafIndex++; - _current = _leafNode[_leafIndex]; + _current = _leafNode![_leafIndex]; return true; } @@ -115,7 +115,7 @@ public void Reset() _leafNode = null; _index = -1; _leafIndex = -1; - _current = default; + _current = default!; } } } diff --git a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeList`1+IndexNode.cs b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeList`1+IndexNode.cs index 7c78c3f..d2fc432 100644 --- a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeList`1+IndexNode.cs +++ b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeList`1+IndexNode.cs @@ -38,7 +38,7 @@ internal IndexNode(Node child1, Node child2) _count = child1.Count + child2.Count; } - internal IndexNode(ImmutableTreeList.Node children, out ImmutableTreeList.Node lastNode) + internal IndexNode(ImmutableTreeList.Node children, out ImmutableTreeList.Node? lastNode) { if (children.Count > _offsets.Length) { @@ -71,7 +71,15 @@ internal IndexNode(ImmutableTreeList.Node children, out ImmutableTreeList< internal int NodeCount => _nodeCount; - internal override LeafNode FirstLeaf => _nodes[0].FirstLeaf; + internal override LeafNode FirstLeaf + { + get + { + LeafNode? firstLeaf = _nodes[0].FirstLeaf; + Debug.Assert(firstLeaf is object, $"Assertion failed: {nameof(firstLeaf)} is object"); + return firstLeaf; + } + } internal override Node FirstChild => _nodes[0]; @@ -172,13 +180,13 @@ internal override int LastIndexOf(T item, TreeSpan span, IEqualityComparer eq return -1; } - internal override (Node currentNode, Node splitNode) Insert(bool isAppend, int index, T item) + internal override (Node currentNode, Node? splitNode) Insert(bool isAppend, int index, T item) { if (IsFrozen) return AsMutable().Insert(isAppend, index, item); int pageIndex = FindLowerBound(_offsets, _nodeCount, index); - (Node currentChild, Node splitChild) = _nodes[pageIndex].Insert(isAppend, index - _offsets[pageIndex], item); + (Node currentChild, Node? splitChild) = _nodes[pageIndex].Insert(isAppend, index - _offsets[pageIndex], item); _nodes[pageIndex] = currentChild; if (splitChild == null) { @@ -241,7 +249,7 @@ internal override ImmutableTreeList.Node InsertRange(bool isAppend, int in Debug.Assert(pageIndex >= 0 && pageIndex <= insertionNode._nodes.Length, "Assertion failed: pageIndex >= 0 && pageIndex <= insertionNode._nodes.Length"); Debug.Assert(!insertionNode.IsFrozen, $"Assertion failed: !{nameof(insertionNode)}.IsFrozen"); - (_, Node newLastIndex) = insertionNode.InsertIndex(isAppend, pageIndex, item); + (_, Node? newLastIndex) = insertionNode.InsertIndex(isAppend, pageIndex, item); if (newLastIndex != null) { // this insertion resulted in a split, so at minimum 'pageIndex' must be updated @@ -297,7 +305,7 @@ internal override Node RemoveLast() { result._nodeCount--; result._offsets[result._nodeCount] = default; - result._nodes[result._nodeCount] = default; + result._nodes[result._nodeCount] = null!; } else { @@ -308,15 +316,15 @@ internal override Node RemoveLast() return result; } - internal override (Node currentNode, Node nextNode) RemoveAt(int index, Node nextNode) + internal override (Node currentNode, Node? nextNode) RemoveAt(int index, Node? nextNode) { if (IsFrozen) return AsMutable().RemoveAt(index, nextNode); int pageIndex = FindLowerBound(_offsets, _nodeCount, index); - Node originalNextChild = pageIndex < _nodeCount - 1 ? _nodes[pageIndex + 1] : nextNode?.FirstChild; + Node? originalNextChild = pageIndex < _nodeCount - 1 ? _nodes[pageIndex + 1] : nextNode?.FirstChild; int? originalNextChildCount = originalNextChild?.Count; - (Node modifiedChild, Node modifiedNextChild) = _nodes[pageIndex].RemoveAt(index - _offsets[pageIndex], originalNextChild); + (Node modifiedChild, Node? modifiedNextChild) = _nodes[pageIndex].RemoveAt(index - _offsets[pageIndex], originalNextChild); _nodes[pageIndex] = modifiedChild; if (modifiedNextChild == originalNextChild && modifiedNextChild?.Count == originalNextChildCount) { @@ -327,11 +335,13 @@ internal override (Node currentNode, Node nextNode) RemoveAt(int index, Node nex return (this, nextNode); } - IndexNode nextIndex = (IndexNode)nextNode; + IndexNode? nextIndex = (IndexNode?)nextNode; bool removedChild = modifiedNextChild == null; if (!removedChild) { + Debug.Assert(modifiedNextChild is object, $"Assertion failed: {nameof(modifiedNextChild)} is object"); + bool affectedNextPage; if (pageIndex < _nodeCount - 1) { @@ -340,6 +350,10 @@ internal override (Node currentNode, Node nextNode) RemoveAt(int index, Node nex } else { + // nextIndex cannot be null if (pageIndex == _nodeCount - 1), because there is no way we needed + // to rebalance the children nodes for that case. This method would have already returned above. + Debug.Assert(nextIndex is object, $"Assertion failed: {nameof(nextIndex)} is object"); + affectedNextPage = true; nextIndex = nextIndex.AsMutable(); nextIndex._nodes[0] = modifiedNextChild; @@ -358,6 +372,8 @@ internal override (Node currentNode, Node nextNode) RemoveAt(int index, Node nex if (affectedNextPage) { + Debug.Assert(nextIndex is object, $"Per the explanation above, {nameof(nextIndex)} cannot be null when {nameof(affectedNextPage)} is true."); + for (int i = 1; i < nextIndex._nodeCount; i++) { nextIndex._offsets[i] = nextIndex._offsets[i - 1] + nextIndex._nodes[i - 1].Count; @@ -373,6 +389,10 @@ internal override (Node currentNode, Node nextNode) RemoveAt(int index, Node nex bool removedFromNextPage = pageIndex == _nodeCount - 1; if (removedFromNextPage) { + // nextIndex cannot be null if (pageIndex == _nodeCount - 1), because there is no way we needed + // to rebalance the children nodes for that case. This method would have already returned above. + Debug.Assert(nextIndex is object, $"Assertion failed: {nameof(nextIndex)} is object"); + if (nextIndex._nodeCount == 1) { // Removed the only child of the next page @@ -388,7 +408,7 @@ internal override (Node currentNode, Node nextNode) RemoveAt(int index, Node nex nextIndex._nodes[0] = _nodes[_nodeCount - 1]; _count = _offsets[_nodeCount - 1]; _offsets[_nodeCount - 1] = 0; - _nodes[_nodeCount - 1] = null; + _nodes[_nodeCount - 1] = null!; _nodeCount--; for (int i = 1; i < nextIndex._nodeCount; i++) { @@ -406,7 +426,7 @@ internal override (Node currentNode, Node nextNode) RemoveAt(int index, Node nex } _offsets[_nodeCount - 1] = 0; - _nodes[_nodeCount - 1] = default; + _nodes[_nodeCount - 1] = null!; _nodeCount--; _count = _offsets[_nodeCount - 1] + _nodes[_nodeCount - 1].Count; } @@ -432,8 +452,8 @@ internal override (Node currentNode, Node nextNode) RemoveAt(int index, Node nex int transferCount = nextIndex._nodeCount - minimumNodeCount; nextIndex._nodes.Copy(0, ref _nodes, _nodeCount, transferCount); nextIndex._nodes.Copy(transferCount, ref nextIndex._nodes, 0, nextIndex._nodeCount - transferCount); - nextIndex._offsets.Clear(nextIndex._nodeCount - transferCount, transferCount); - nextIndex._nodes.Clear(nextIndex._nodeCount - transferCount, transferCount); + nextIndex._offsets.MarkAsUnused(nextIndex._nodeCount - transferCount, transferCount); + nextIndex._nodes.MarkAsUnused(nextIndex._nodeCount - transferCount, transferCount); for (int i = 0; i < transferCount; i++) { _offsets[_nodeCount + i] = _offsets[_nodeCount + i - 1] + _nodes[_nodeCount + i - 1].Count; @@ -622,7 +642,7 @@ internal override int BinarySearch(TreeSpan span, T item, IComparer comparer) int page = lowPage + ((highPage - lowPage + 1) >> 1); Debug.Assert(page > firstPage, $"Assertion failed: {nameof(page)} > {nameof(firstPage)}"); - T value = _nodes[page].FirstLeaf[0]; + T value = _nodes[page].FirstLeaf![0]; int c; try @@ -663,11 +683,11 @@ internal override int BinarySearch(TreeSpan span, T item, IComparer comparer) } } - internal override ImmutableTreeList.Node ConvertAll(Func converter, ImmutableTreeList.Node convertedNextNode) + internal override ImmutableTreeList.Node ConvertAll(Func converter, ImmutableTreeList.Node? convertedNextNode) { var result = new ImmutableTreeList.IndexNode(); - ImmutableTreeList.Node convertedNextChild = convertedNextNode?.FirstChild; + ImmutableTreeList.Node? convertedNextChild = convertedNextNode?.FirstChild; for (int i = _nodeCount - 1; i >= 0; i--) { convertedNextChild = _nodes[i].ConvertAll(converter, convertedNextChild); @@ -680,14 +700,14 @@ internal override ImmutableTreeList.Node ConvertAll(Func= 2, $"Assertion failed: {nameof(_nodes.Length)} >= 2"); Debug.Assert(_offsets.Length == _nodes.Length, $"Assertion failed: {nameof(_offsets)}.Length == {nameof(_nodes)}.Length"); diff --git a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeList`1+LeafNode.cs b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeList`1+LeafNode.cs index 88ef3ac..1f41e74 100644 --- a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeList`1+LeafNode.cs +++ b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeList`1+LeafNode.cs @@ -29,7 +29,7 @@ private LeafNode(LeafNode node) internal override LeafNode FirstLeaf => this; - internal override Node FirstChild => null; + internal override Node? FirstChild => null; internal override bool IsFrozen => _frozen; @@ -79,7 +79,7 @@ internal override int LastIndexOf(T item, TreeSpan span, IEqualityComparer eq return _data.LastIndexOf(item, span.EndInclusive, span.Count, equalityComparer); } - internal override ImmutableTreeList.Node ConvertAll(Func converter, ImmutableTreeList.Node convertedNextNode) + internal override ImmutableTreeList.Node ConvertAll(Func converter, ImmutableTreeList.Node? convertedNextNode) { var result = new ImmutableTreeList.LeafNode(); @@ -92,7 +92,7 @@ internal override ImmutableTreeList.Node ConvertAll(Func.Node InsertRange(bool isAppend, int in { Debug.Assert(index >= 0 && index <= ((LeafNode)insertionNode)._data.Length, "Assertion failed: index >= 0 && index <= ((LeafNode)insertionNode)._data.Length"); - (_, Node newLastLeaf) = insertionNode.Insert(isAppend, index, item); + (_, Node? newLastLeaf) = insertionNode.Insert(isAppend, index, item); if (newLastLeaf != null) { // this insertion resulted in a split, so at minimum 'index' must be updated @@ -225,11 +225,11 @@ internal override Node RemoveLast() LeafNode result = AsMutable(); result._count--; - result._data[result._count] = default; + result._data[result._count] = default!; return result; } - internal override (Node currentNode, Node nextNode) RemoveAt(int index, Node nextNode) + internal override (Node currentNode, Node? nextNode) RemoveAt(int index, Node? nextNode) { if (IsFrozen) return AsMutable().RemoveAt(index, nextNode); @@ -239,7 +239,7 @@ internal override (Node currentNode, Node nextNode) RemoveAt(int index, Node nex _data[i] = _data[i + 1]; } - _data[_count - 1] = default; + _data[_count - 1] = default!; _count--; if (_count < _data.Length / 2 && nextNode != null) @@ -259,7 +259,7 @@ internal override (Node currentNode, Node nextNode) RemoveAt(int index, Node nex int transferCount = nextNode.Count - minimumNodeCount; ((LeafNode)nextNode)._data.Copy(0, ref _data, _count, transferCount); ((LeafNode)nextNode)._data.Copy(transferCount, ref ((LeafNode)nextNode)._data, 0, nextNode.Count - transferCount); - ((LeafNode)nextNode)._data.Clear(nextNode.Count - transferCount, transferCount); + ((LeafNode)nextNode)._data.MarkAsUnused(nextNode.Count - transferCount, transferCount); _count += transferCount; ((LeafNode)nextNode)._count -= transferCount; return (this, nextNode); @@ -303,7 +303,7 @@ internal override int BinarySearch(TreeSpan span, T item, IComparer comparer) return _data.BinarySearch(span.Start, span.Count, item, comparer); } - internal override (Node currentNode, Node nextNode) TrimExcessImpl(Node nextNode) + internal override (Node currentNode, Node? nextNode) TrimExcessImpl(Node? nextNode) { if (_count == _data.Length || nextNode == null) return (this, nextNode); @@ -311,7 +311,7 @@ internal override (Node currentNode, Node nextNode) TrimExcessImpl(Node nextNode if (IsFrozen) return AsMutable().TrimExcessImpl(nextNode); - LeafNode nextLeaf = ((LeafNode)nextNode).AsMutable(); + LeafNode? nextLeaf = ((LeafNode)nextNode).AsMutable(); int elementsToMove = Math.Min(_data.Length - _count, nextNode.Count); nextLeaf._data.Copy(0, ref _data, _count, elementsToMove); _count += elementsToMove; @@ -324,13 +324,13 @@ internal override (Node currentNode, Node nextNode) TrimExcessImpl(Node nextNode { nextLeaf._data.Copy(elementsToMove, ref nextLeaf._data, 0, nextLeaf._count - elementsToMove); nextLeaf._count -= elementsToMove; - nextLeaf._data.Clear(nextLeaf._count, elementsToMove); + nextLeaf._data.MarkAsUnused(nextLeaf._count, elementsToMove); } return (this, nextLeaf); } - internal override void Validate(ValidationRules rules, Node nextNode) + internal override void Validate(ValidationRules rules, Node? nextNode) { Debug.Assert(_data.Length >= 2, $"Assertion failed: {nameof(_data.Length)} >= 2"); Debug.Assert(_count >= 0 && _count <= _data.Length, $"Assertion failed: {nameof(_count)} >= 0 && {nameof(_count)} <= {nameof(_data)}.Length"); diff --git a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeList`1+Node.cs b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeList`1+Node.cs index 13b9b9f..d16124c 100644 --- a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeList`1+Node.cs +++ b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeList`1+Node.cs @@ -21,12 +21,12 @@ internal abstract int Count get; } - internal abstract LeafNode FirstLeaf + internal abstract LeafNode? FirstLeaf { get; } - internal abstract Node FirstChild + internal abstract Node? FirstChild { get; } @@ -52,7 +52,7 @@ internal static Node Insert(Node root, int index, T item) if (index > root.Count) throw new ArgumentOutOfRangeException(nameof(index)); - (Node newRoot, Node splitNode) = root.Insert(index == root.Count, index, item); + (Node newRoot, Node? splitNode) = root.Insert(index == root.Count, index, item); if (splitNode == null) return newRoot; @@ -75,7 +75,7 @@ internal static Node InsertRange(Node root, int index, IEnumerable collection if (root == Empty) root = new LeafNode(); - ImmutableTreeList.Node splitNode = root.InsertRange(index == root.Count, index, collection); + ImmutableTreeList.Node? splitNode = root.InsertRange(index == root.Count, index, collection); while (splitNode != null) { if (splitNode.Count == 1) @@ -161,7 +161,7 @@ internal static Node RemoveAll(Node root, Predicate match) internal static Node TrimExcess(Node root) { - (Node newRoot, Node mustBeNull) = root.TrimExcessImpl(null); + (Node newRoot, Node? mustBeNull) = root.TrimExcessImpl(null); Debug.Assert(mustBeNull == null, $"Assertion failed: {nameof(mustBeNull)} == null"); while (newRoot.FirstChild != null && ((IndexNode)newRoot).NodeCount == 1) { @@ -194,13 +194,13 @@ internal Node Reverse(TreeSpan span) internal abstract int LastIndexOf(T item, TreeSpan span, IEqualityComparer equalityComparer); - internal abstract (Node currentNode, Node splitNode) Insert(bool isAppend, int index, T item); + internal abstract (Node currentNode, Node? splitNode) Insert(bool isAppend, int index, T item); internal abstract ImmutableTreeList.Node InsertRange(bool isAppend, int index, IEnumerable collection); internal abstract Node RemoveLast(); - internal abstract (Node currentNode, Node nextNode) RemoveAt(int index, Node nextNode); + internal abstract (Node currentNode, Node? nextNode) RemoveAt(int index, Node? nextNode); internal abstract Node Sort(TreeSpan span, IComparer comparer); @@ -215,19 +215,19 @@ internal ImmutableTreeList.Node ConvertAll(Func co return ConvertAll(converter, null); } - internal abstract ImmutableTreeList.Node ConvertAll(Func converter, ImmutableTreeList.Node convertedNextNode); + internal abstract ImmutableTreeList.Node ConvertAll(Func converter, ImmutableTreeList.Node? convertedNextNode); - internal abstract (Node currentNode, Node nextNode) TrimExcessImpl(Node nextNode); + internal abstract (Node currentNode, Node? nextNode) TrimExcessImpl(Node? nextNode); - internal abstract void Validate(ValidationRules rules, Node nextNode); + internal abstract void Validate(ValidationRules rules, Node? nextNode); private sealed class EmptyNode : Node { internal override int Count => 0; - internal override LeafNode FirstLeaf => null; + internal override LeafNode? FirstLeaf => null; - internal override Node FirstChild => null; + internal override Node? FirstChild => null; internal override bool IsFrozen => true; @@ -269,7 +269,7 @@ internal override int LastIndexOf(T item, TreeSpan span, IEqualityComparer eq throw ExceptionUtilities.Unreachable; } - internal override (Node currentNode, Node splitNode) Insert(bool isAppend, int index, T item) + internal override (Node currentNode, Node? splitNode) Insert(bool isAppend, int index, T item) { Debug.Assert(index == 0 && isAppend, "index == 0 && isAppend"); return new LeafNode().Insert(isAppend, index, item); @@ -288,7 +288,7 @@ internal override Node RemoveLast() } [ExcludeFromCodeCoverage] - internal override (Node currentNode, Node nextNode) RemoveAt(int index, Node nextNode) + internal override (Node currentNode, Node? nextNode) RemoveAt(int index, Node? nextNode) { throw ExceptionUtilities.Unreachable; } @@ -325,19 +325,19 @@ internal override int BinarySearch(TreeSpan span, T item, IComparer comparer) return ~0; } - internal override ImmutableTreeList.Node ConvertAll(Func converter, ImmutableTreeList.Node convertedNextNode) + internal override ImmutableTreeList.Node ConvertAll(Func converter, ImmutableTreeList.Node? convertedNextNode) { return ImmutableTreeList.Node.Empty; } - internal override (Node currentNode, Node nextNode) TrimExcessImpl(Node nextNode) + internal override (Node currentNode, Node? nextNode) TrimExcessImpl(Node? nextNode) { Debug.Assert(nextNode == null, $"Assertion failed: {nameof(nextNode)} == null"); return (this, null); } - internal override void Validate(ValidationRules rules, Node nextNode) + internal override void Validate(ValidationRules rules, Node? nextNode) { Debug.Assert(this == Empty, $"Assertion failed: this == {nameof(Empty)}"); Debug.Assert(nextNode == null, $"Assertion failed: {nameof(nextNode)} == null"); diff --git a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeList`1.cs b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeList`1.cs index 2c9376f..52c5119 100644 --- a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeList`1.cs +++ b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeList`1.cs @@ -8,6 +8,7 @@ namespace TunnelVisionLabs.Collections.Trees.Immutable using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics; + using System.Diagnostics.CodeAnalysis; using System.Linq; public sealed partial class ImmutableTreeList : IImmutableList, IReadOnlyList, IList, IList @@ -55,7 +56,7 @@ T IList.this[int index] set => throw new NotSupportedException(); } - object IList.this[int index] + object? IList.this[int index] { get => this[index]; set => throw new NotSupportedException(); @@ -80,9 +81,9 @@ public ImmutableTreeList AddRange(IEnumerable items) public int BinarySearch(T item) => BinarySearch(0, Count, item, comparer: null); - public int BinarySearch(T item, IComparer comparer) => BinarySearch(0, Count, item, comparer); + public int BinarySearch(T item, IComparer? comparer) => BinarySearch(0, Count, item, comparer); - public int BinarySearch(int index, int count, T item, IComparer comparer) + public int BinarySearch(int index, int count, T item, IComparer? comparer) { if (index < 0) throw new ArgumentOutOfRangeException(nameof(index)); @@ -132,6 +133,7 @@ public void CopyTo(int index, T[] array, int arrayIndex, int count) public bool Exists(Predicate match) => FindIndex(match) >= 0; + [return: MaybeNull] public T Find(Predicate match) { if (match == null) @@ -172,6 +174,7 @@ public int FindIndex(int startIndex, int count, Predicate match) return _root.FindIndex(new TreeSpan(startIndex, count), match); } + [return: MaybeNull] public T FindLast(Predicate match) { int index = FindLastIndex(match); @@ -235,7 +238,7 @@ public ImmutableTreeList GetRange(int index, int count) public int IndexOf(T value) => IndexOf(value, 0, Count, equalityComparer: null); - public int IndexOf(T item, int index, int count, IEqualityComparer equalityComparer) + public int IndexOf(T item, int index, int count, IEqualityComparer? equalityComparer) { if (index < 0) throw new ArgumentOutOfRangeException(nameof(index)); @@ -264,7 +267,7 @@ public ImmutableTreeList InsertRange(int index, IEnumerable items) return new ImmutableTreeList(root); } - public int LastIndexOf(T item, int index, int count, IEqualityComparer equalityComparer) + public int LastIndexOf(T item, int index, int count, IEqualityComparer? equalityComparer) { if (Count == 0) { @@ -289,7 +292,7 @@ public int LastIndexOf(T item, int index, int count, IEqualityComparer equali public ImmutableTreeList Remove(T value) => Remove(value, equalityComparer: null); - public ImmutableTreeList Remove(T value, IEqualityComparer equalityComparer) + public ImmutableTreeList Remove(T value, IEqualityComparer? equalityComparer) { int index = IndexOf(value, 0, Count, equalityComparer); if (index >= 0) @@ -320,7 +323,7 @@ public ImmutableTreeList RemoveAt(int index) public ImmutableTreeList RemoveRange(IEnumerable items) => RemoveRange(items, equalityComparer: null); - public ImmutableTreeList RemoveRange(IEnumerable items, IEqualityComparer equalityComparer) + public ImmutableTreeList RemoveRange(IEnumerable items, IEqualityComparer? equalityComparer) { if (items is null) throw new ArgumentNullException(nameof(items)); @@ -346,7 +349,7 @@ public ImmutableTreeList RemoveRange(int index, int count) public ImmutableTreeList Replace(T oldValue, T newValue) => Replace(oldValue, newValue, equalityComparer: null); - public ImmutableTreeList Replace(T oldValue, T newValue, IEqualityComparer equalityComparer) + public ImmutableTreeList Replace(T oldValue, T newValue, IEqualityComparer? equalityComparer) { int index = IndexOf(oldValue, 0, Count, equalityComparer); if (index < 0) @@ -393,7 +396,7 @@ public ImmutableTreeList SetItem(int index, T value) public ImmutableTreeList Sort() => Sort(0, Count, comparer: null); - public ImmutableTreeList Sort(IComparer comparer) => Sort(0, Count, comparer); + public ImmutableTreeList Sort(IComparer? comparer) => Sort(0, Count, comparer); public ImmutableTreeList Sort(Comparison comparison) { @@ -403,7 +406,7 @@ public ImmutableTreeList Sort(Comparison comparison) return Sort(0, Count, new ComparisonComparer(comparison)); } - public ImmutableTreeList Sort(int index, int count, IComparer comparer) + public ImmutableTreeList Sort(int index, int count, IComparer? comparer) { if (index < 0) throw new ArgumentOutOfRangeException(nameof(index)); @@ -474,16 +477,16 @@ public bool TrueForAll(Predicate match) bool ICollection.Remove(T item) => throw new NotSupportedException(); - int IList.Add(object value) => throw new NotSupportedException(); + int IList.Add(object? value) => throw new NotSupportedException(); void IList.Clear() => throw new NotSupportedException(); - bool IList.Contains(object value) + bool IList.Contains(object? value) { if (value == null) { if (default(T) == null) - return Contains(default); + return Contains(default!); } else if (value is T) { @@ -493,12 +496,12 @@ bool IList.Contains(object value) return false; } - int IList.IndexOf(object value) + int IList.IndexOf(object? value) { if (value == null) { if (default(T) == null) - return IndexOf(default); + return IndexOf(default!); } else if (value is T) { @@ -508,9 +511,9 @@ int IList.IndexOf(object value) return -1; } - void IList.Insert(int index, object value) => throw new NotSupportedException(); + void IList.Insert(int index, object? value) => throw new NotSupportedException(); - void IList.Remove(object value) => throw new NotSupportedException(); + void IList.Remove(object? value) => throw new NotSupportedException(); void IList.RemoveAt(int index) => throw new NotSupportedException(); diff --git a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeQueue`1+Enumerator.cs b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeQueue`1+Enumerator.cs index 77fa2ce..73ee62c 100644 --- a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeQueue`1+Enumerator.cs +++ b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeQueue`1+Enumerator.cs @@ -20,7 +20,7 @@ internal Enumerator(ImmutableTreeList.Enumerator enumerator) public T Current => _enumerator.Current; - object IEnumerator.Current => _enumerator.Current; + object? IEnumerator.Current => _enumerator.Current; public bool MoveNext() => _enumerator.MoveNext(); diff --git a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeSet.cs b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeSet.cs index c687dc0..8944ffe 100644 --- a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeSet.cs +++ b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeSet.cs @@ -17,31 +17,31 @@ public static ImmutableTreeSet Create(T item) public static ImmutableTreeSet Create(params T[] items) => ImmutableTreeSet.Empty.Union(items); - public static ImmutableTreeSet Create(IEqualityComparer equalityComparer) + public static ImmutableTreeSet Create(IEqualityComparer? equalityComparer) => ImmutableTreeSet.Empty.WithComparer(equalityComparer); - public static ImmutableTreeSet Create(IEqualityComparer equalityComparer, T item) + public static ImmutableTreeSet Create(IEqualityComparer? equalityComparer, T item) => ImmutableTreeSet.Empty.WithComparer(equalityComparer).Add(item); - public static ImmutableTreeSet Create(IEqualityComparer equalityComparer, params T[] items) + public static ImmutableTreeSet Create(IEqualityComparer? equalityComparer, params T[] items) => ImmutableTreeSet.Empty.WithComparer(equalityComparer).Union(items); public static ImmutableTreeSet.Builder CreateBuilder() => Create().ToBuilder(); - public static ImmutableTreeSet.Builder CreateBuilder(IEqualityComparer equalityComparer) + public static ImmutableTreeSet.Builder CreateBuilder(IEqualityComparer? equalityComparer) => Create(equalityComparer).ToBuilder(); public static ImmutableTreeSet CreateRange(IEnumerable items) => ImmutableTreeSet.Empty.Union(items); - public static ImmutableTreeSet CreateRange(IEqualityComparer equalityComparer, IEnumerable items) + public static ImmutableTreeSet CreateRange(IEqualityComparer? equalityComparer, IEnumerable items) => ImmutableTreeSet.Empty.WithComparer(equalityComparer).Union(items); public static ImmutableTreeSet ToImmutableTreeSet(this IEnumerable source) => ToImmutableTreeSet(source, equalityComparer: null); - public static ImmutableTreeSet ToImmutableTreeSet(this IEnumerable source, IEqualityComparer equalityComparer) + public static ImmutableTreeSet ToImmutableTreeSet(this IEnumerable source, IEqualityComparer? equalityComparer) { if (source is null) throw new ArgumentNullException(nameof(source)); diff --git a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeSet`1+Builder.cs b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeSet`1+Builder.cs index 1a0aad4..131c761 100644 --- a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeSet`1+Builder.cs +++ b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeSet`1+Builder.cs @@ -7,6 +7,7 @@ namespace TunnelVisionLabs.Collections.Trees.Immutable using System.Collections; using System.Collections.Generic; using System.Diagnostics; + using System.Diagnostics.CodeAnalysis; using System.Linq; public partial class ImmutableTreeSet @@ -443,7 +444,7 @@ public void UnionWith(IEnumerable other) internal void TrimExcess() => _sortedList.TrimExcess(); - internal bool TryGetValue(T equalValue, out T actualValue) + internal bool TryGetValue(T equalValue, [MaybeNullWhen(false)] out T actualValue) { int hashCode = KeyComparer.GetHashCode(equalValue); diff --git a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeSet`1+Enumerator.cs b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeSet`1+Enumerator.cs index 953af9d..bc6cd91 100644 --- a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeSet`1+Enumerator.cs +++ b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeSet`1+Enumerator.cs @@ -19,7 +19,7 @@ internal Enumerator(ImmutableSortedTreeList<(int hashCode, T value)>.Enumerator public T Current => _enumerator.Current.value; - object IEnumerator.Current => Current; + object? IEnumerator.Current => Current; public void Dispose() => _enumerator.Dispose(); diff --git a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeSet`1.cs b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeSet`1.cs index 334b870..239f24e 100644 --- a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeSet`1.cs +++ b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeSet`1.cs @@ -7,6 +7,7 @@ namespace TunnelVisionLabs.Collections.Trees.Immutable using System.Collections; using System.Collections.Generic; using System.Collections.Immutable; + using System.Diagnostics.CodeAnalysis; public sealed partial class ImmutableTreeSet : IImmutableSet, ISet, ICollection { @@ -100,7 +101,9 @@ public ImmutableTreeSet SymmetricExcept(IEnumerable other) return builder.ToImmutable(); } - public bool TryGetValue(T equalValue, out T actualValue) +#pragma warning disable CS8767 // Nullability of reference types in type of parameter doesn't match implicitly implemented member (possibly because of nullability attributes). + public bool TryGetValue(T equalValue, [MaybeNullWhen(false)] out T actualValue) +#pragma warning restore CS8767 // Nullability of reference types in type of parameter doesn't match implicitly implemented member (possibly because of nullability attributes). => ToBuilder().TryGetValue(equalValue, out actualValue); public ImmutableTreeSet Union(IEnumerable other) @@ -113,7 +116,7 @@ public ImmutableTreeSet Union(IEnumerable other) public Builder ToBuilder() => new Builder(this); - public ImmutableTreeSet WithComparer(IEqualityComparer equalityComparer) + public ImmutableTreeSet WithComparer(IEqualityComparer? equalityComparer) { equalityComparer = equalityComparer ?? EqualityComparer.Default; if (equalityComparer == _comparer) diff --git a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeStack`1+Enumerator.cs b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeStack`1+Enumerator.cs index 3bb8f39..7da9a35 100644 --- a/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeStack`1+Enumerator.cs +++ b/TunnelVisionLabs.Collections.Trees/Immutable/ImmutableTreeStack`1+Enumerator.cs @@ -20,7 +20,7 @@ internal Enumerator(ImmutableTreeList.Enumerator enumerator) public T Current => _enumerator.Current; - object IEnumerator.Current => _enumerator.Current; + object? IEnumerator.Current => _enumerator.Current; public bool MoveNext() => _enumerator.MoveNext(); diff --git a/TunnelVisionLabs.Collections.Trees/PublicAPI.Shipped.txt b/TunnelVisionLabs.Collections.Trees/PublicAPI.Shipped.txt index e69de29..7dc5c58 100644 --- a/TunnelVisionLabs.Collections.Trees/PublicAPI.Shipped.txt +++ b/TunnelVisionLabs.Collections.Trees/PublicAPI.Shipped.txt @@ -0,0 +1 @@ +#nullable enable diff --git a/TunnelVisionLabs.Collections.Trees/PublicAPI.Unshipped.txt b/TunnelVisionLabs.Collections.Trees/PublicAPI.Unshipped.txt index fcb93a2..77db173 100644 --- a/TunnelVisionLabs.Collections.Trees/PublicAPI.Unshipped.txt +++ b/TunnelVisionLabs.Collections.Trees/PublicAPI.Unshipped.txt @@ -1,11 +1,12 @@ +#nullable enable TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Add(TKey key, TValue value) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.AddRange(System.Collections.Generic.IEnumerable> pairs) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Add(TKey key, TValue value) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.AddRange(System.Collections.Generic.IEnumerable>! pairs) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary! TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Builder TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Builder.Add(System.Collections.Generic.KeyValuePair item) -> void TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Builder.Add(TKey key, TValue value) -> void -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Builder.AddRange(System.Collections.Generic.IEnumerable> items) -> void +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Builder.AddRange(System.Collections.Generic.IEnumerable>! items) -> void TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Builder.Clear() -> void TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Builder.Contains(System.Collections.Generic.KeyValuePair item) -> bool TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Builder.ContainsKey(TKey key) -> bool @@ -17,31 +18,29 @@ TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Builder.KeyCollection TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Builder.KeyCollection.Clear() -> void TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Builder.KeyCollection.Contains(TKey item) -> bool -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Builder.KeyCollection.CopyTo(TKey[] array, int arrayIndex) -> void +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Builder.KeyCollection.CopyTo(TKey[]! array, int arrayIndex) -> void TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Builder.KeyCollection.Count.get -> int TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Builder.KeyCollection.GetEnumerator() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.KeyCollection.Enumerator -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Builder.KeyCollection.KeyCollection() -> void TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Builder.KeyCollection.Remove(TKey item) -> bool -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Builder.KeyComparer.get -> System.Collections.Generic.IComparer +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Builder.KeyComparer.get -> System.Collections.Generic.IComparer! TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Builder.Keys.get -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Builder.KeyCollection TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Builder.Remove(System.Collections.Generic.KeyValuePair item) -> bool TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Builder.Remove(TKey key) -> bool -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Builder.RemoveRange(System.Collections.Generic.IEnumerable keys) -> void -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Builder.ToImmutable() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Builder.RemoveRange(System.Collections.Generic.IEnumerable! keys) -> void +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Builder.ToImmutable() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary! TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Builder.TryGetKey(TKey equalKey, out TKey actualKey) -> bool TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Builder.TryGetValue(TKey key, out TValue value) -> bool TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Builder.ValueCollection TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Builder.ValueCollection.Clear() -> void TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Builder.ValueCollection.Contains(TValue item) -> bool -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Builder.ValueCollection.CopyTo(TValue[] array, int arrayIndex) -> void +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Builder.ValueCollection.CopyTo(TValue[]! array, int arrayIndex) -> void TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Builder.ValueCollection.Count.get -> int TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Builder.ValueCollection.GetEnumerator() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.ValueCollection.Enumerator -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Builder.ValueCollection.ValueCollection() -> void -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Builder.ValueComparer.get -> System.Collections.Generic.IEqualityComparer +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Builder.ValueComparer.get -> System.Collections.Generic.IEqualityComparer! TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Builder.Values.get -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Builder.ValueCollection TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Builder.this[TKey key].get -> TValue TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Builder.this[TKey key].set -> void -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Clear() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Clear() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary! TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Contains(System.Collections.Generic.KeyValuePair pair) -> bool TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.ContainsKey(TKey key) -> bool TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.ContainsValue(TValue value) -> bool @@ -49,7 +48,6 @@ TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Enumerator TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Enumerator.Current.get -> System.Collections.Generic.KeyValuePair TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Enumerator.Dispose() -> void -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Enumerator.Enumerator() -> void TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Enumerator.MoveNext() -> bool TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Enumerator.Reset() -> void TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.GetEnumerator() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Enumerator @@ -60,18 +58,16 @@ TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.KeyCollection.Enumerator TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.KeyCollection.Enumerator.Current.get -> TKey TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.KeyCollection.Enumerator.Dispose() -> void -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.KeyCollection.Enumerator.Enumerator() -> void TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.KeyCollection.Enumerator.MoveNext() -> bool TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.KeyCollection.Enumerator.Reset() -> void TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.KeyCollection.GetEnumerator() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.KeyCollection.Enumerator -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.KeyCollection.KeyCollection() -> void -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.KeyComparer.get -> System.Collections.Generic.IComparer +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.KeyComparer.get -> System.Collections.Generic.IComparer! TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Keys.get -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.KeyCollection -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Remove(TKey key) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.RemoveRange(System.Collections.Generic.IEnumerable keys) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.SetItem(TKey key, TValue value) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.SetItems(System.Collections.Generic.IEnumerable> items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.ToBuilder() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Builder +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Remove(TKey key) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.RemoveRange(System.Collections.Generic.IEnumerable! keys) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.SetItem(TKey key, TValue value) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.SetItems(System.Collections.Generic.IEnumerable>! items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.ToBuilder() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Builder! TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.TryGetKey(TKey equalKey, out TKey actualKey) -> bool TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.TryGetValue(TKey key, out TValue value) -> bool TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.ValueCollection @@ -80,81 +76,78 @@ TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.ValueCollection.Enumerator TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.ValueCollection.Enumerator.Current.get -> TValue TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.ValueCollection.Enumerator.Dispose() -> void -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.ValueCollection.Enumerator.Enumerator() -> void TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.ValueCollection.Enumerator.MoveNext() -> bool TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.ValueCollection.Enumerator.Reset() -> void TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.ValueCollection.GetEnumerator() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.ValueCollection.Enumerator -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.ValueCollection.ValueCollection() -> void -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.ValueComparer.get -> System.Collections.Generic.IEqualityComparer +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.ValueComparer.get -> System.Collections.Generic.IEqualityComparer! TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Values.get -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.ValueCollection -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.WithComparers(System.Collections.Generic.IComparer keyComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.WithComparers(System.Collections.Generic.IComparer keyComparer, System.Collections.Generic.IEqualityComparer valueComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.WithComparers(System.Collections.Generic.IComparer? keyComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.WithComparers(System.Collections.Generic.IComparer? keyComparer, System.Collections.Generic.IEqualityComparer? valueComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary! TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.this[TKey key].get -> TValue TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Add(T value) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Add(T value) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet! TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Builder TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Builder.Add(T item) -> bool TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Builder.Clear() -> void TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Builder.Contains(T item) -> bool TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Builder.Count.get -> int -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Builder.ExceptWith(System.Collections.Generic.IEnumerable other) -> void +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Builder.ExceptWith(System.Collections.Generic.IEnumerable! other) -> void TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Builder.GetEnumerator() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Enumerator -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Builder.IntersectWith(System.Collections.Generic.IEnumerable other) -> void -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Builder.IsProperSubsetOf(System.Collections.Generic.IEnumerable other) -> bool -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Builder.IsProperSupersetOf(System.Collections.Generic.IEnumerable other) -> bool -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Builder.IsSubsetOf(System.Collections.Generic.IEnumerable other) -> bool -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Builder.IsSupersetOf(System.Collections.Generic.IEnumerable other) -> bool -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Builder.KeyComparer.get -> System.Collections.Generic.IComparer +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Builder.IntersectWith(System.Collections.Generic.IEnumerable! other) -> void +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Builder.IsProperSubsetOf(System.Collections.Generic.IEnumerable! other) -> bool +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Builder.IsProperSupersetOf(System.Collections.Generic.IEnumerable! other) -> bool +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Builder.IsSubsetOf(System.Collections.Generic.IEnumerable! other) -> bool +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Builder.IsSupersetOf(System.Collections.Generic.IEnumerable! other) -> bool +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Builder.KeyComparer.get -> System.Collections.Generic.IComparer! TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Builder.Max.get -> T TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Builder.Min.get -> T -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Builder.Overlaps(System.Collections.Generic.IEnumerable other) -> bool +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Builder.Overlaps(System.Collections.Generic.IEnumerable! other) -> bool TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Builder.Remove(T item) -> bool -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Builder.Reverse() -> System.Collections.Generic.IEnumerable -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Builder.SetEquals(System.Collections.Generic.IEnumerable other) -> bool -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Builder.SymmetricExceptWith(System.Collections.Generic.IEnumerable other) -> void -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Builder.ToImmutable() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Builder.UnionWith(System.Collections.Generic.IEnumerable other) -> void +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Builder.Reverse() -> System.Collections.Generic.IEnumerable! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Builder.SetEquals(System.Collections.Generic.IEnumerable! other) -> bool +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Builder.SymmetricExceptWith(System.Collections.Generic.IEnumerable! other) -> void +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Builder.ToImmutable() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Builder.UnionWith(System.Collections.Generic.IEnumerable! other) -> void TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Builder.this[int index].get -> T -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Clear() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Clear() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet! TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Contains(T value) -> bool TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Count.get -> int TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Enumerator TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Enumerator.Current.get -> T TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Enumerator.Dispose() -> void -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Enumerator.Enumerator() -> void TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Enumerator.MoveNext() -> bool TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Enumerator.Reset() -> void -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Except(System.Collections.Generic.IEnumerable other) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Except(System.Collections.Generic.IEnumerable! other) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet! TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.GetEnumerator() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Enumerator TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.IndexOf(T item) -> int -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Intersect(System.Collections.Generic.IEnumerable other) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Intersect(System.Collections.Generic.IEnumerable! other) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet! TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.IsEmpty.get -> bool -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.IsProperSubsetOf(System.Collections.Generic.IEnumerable other) -> bool -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.IsProperSupersetOf(System.Collections.Generic.IEnumerable other) -> bool -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.IsSubsetOf(System.Collections.Generic.IEnumerable other) -> bool -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.IsSupersetOf(System.Collections.Generic.IEnumerable other) -> bool -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.KeyComparer.get -> System.Collections.Generic.IComparer +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.IsProperSubsetOf(System.Collections.Generic.IEnumerable! other) -> bool +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.IsProperSupersetOf(System.Collections.Generic.IEnumerable! other) -> bool +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.IsSubsetOf(System.Collections.Generic.IEnumerable! other) -> bool +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.IsSupersetOf(System.Collections.Generic.IEnumerable! other) -> bool +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.KeyComparer.get -> System.Collections.Generic.IComparer! TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Max.get -> T TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Min.get -> T -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Overlaps(System.Collections.Generic.IEnumerable other) -> bool -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Remove(T value) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Reverse() -> System.Collections.Generic.IEnumerable -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.SetEquals(System.Collections.Generic.IEnumerable other) -> bool -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.SymmetricExcept(System.Collections.Generic.IEnumerable other) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.ToBuilder() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Builder +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Overlaps(System.Collections.Generic.IEnumerable! other) -> bool +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Remove(T value) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Reverse() -> System.Collections.Generic.IEnumerable! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.SetEquals(System.Collections.Generic.IEnumerable! other) -> bool +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.SymmetricExcept(System.Collections.Generic.IEnumerable! other) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.ToBuilder() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Builder! TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.TryGetValue(T equalValue, out T actualValue) -> bool -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Union(System.Collections.Generic.IEnumerable other) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.WithComparer(System.Collections.Generic.IComparer comparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Union(System.Collections.Generic.IEnumerable! other) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.WithComparer(System.Collections.Generic.IComparer? comparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet! TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.this[int index].get -> T TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Add(TKey key, TValue value) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.AddRange(System.Collections.Generic.IEnumerable> pairs) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Add(TKey key, TValue value) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.AddRange(System.Collections.Generic.IEnumerable>! pairs) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary! TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Builder TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Builder.Add(System.Collections.Generic.KeyValuePair item) -> void TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Builder.Add(TKey key, TValue value) -> void -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Builder.AddRange(System.Collections.Generic.IEnumerable> items) -> void +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Builder.AddRange(System.Collections.Generic.IEnumerable>! items) -> void TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Builder.Clear() -> void TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Builder.Contains(System.Collections.Generic.KeyValuePair item) -> bool TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Builder.ContainsKey(TKey key) -> bool @@ -166,31 +159,29 @@ TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Builder.KeyCollection TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Builder.KeyCollection.Clear() -> void TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Builder.KeyCollection.Contains(TKey item) -> bool -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Builder.KeyCollection.CopyTo(TKey[] array, int arrayIndex) -> void +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Builder.KeyCollection.CopyTo(TKey[]! array, int arrayIndex) -> void TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Builder.KeyCollection.Count.get -> int TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Builder.KeyCollection.GetEnumerator() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.KeyCollection.Enumerator -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Builder.KeyCollection.KeyCollection() -> void TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Builder.KeyCollection.Remove(TKey item) -> bool -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Builder.KeyComparer.get -> System.Collections.Generic.IEqualityComparer +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Builder.KeyComparer.get -> System.Collections.Generic.IEqualityComparer! TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Builder.Keys.get -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Builder.KeyCollection TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Builder.Remove(System.Collections.Generic.KeyValuePair item) -> bool TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Builder.Remove(TKey key) -> bool -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Builder.RemoveRange(System.Collections.Generic.IEnumerable keys) -> void -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Builder.ToImmutable() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Builder.RemoveRange(System.Collections.Generic.IEnumerable! keys) -> void +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Builder.ToImmutable() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary! TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Builder.TryGetKey(TKey equalKey, out TKey actualKey) -> bool TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Builder.TryGetValue(TKey key, out TValue value) -> bool TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Builder.ValueCollection TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Builder.ValueCollection.Clear() -> void TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Builder.ValueCollection.Contains(TValue item) -> bool -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Builder.ValueCollection.CopyTo(TValue[] array, int arrayIndex) -> void +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Builder.ValueCollection.CopyTo(TValue[]! array, int arrayIndex) -> void TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Builder.ValueCollection.Count.get -> int TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Builder.ValueCollection.GetEnumerator() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.ValueCollection.Enumerator -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Builder.ValueCollection.ValueCollection() -> void -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Builder.ValueComparer.get -> System.Collections.Generic.IEqualityComparer +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Builder.ValueComparer.get -> System.Collections.Generic.IEqualityComparer! TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Builder.Values.get -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Builder.ValueCollection TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Builder.this[TKey key].get -> TValue TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Builder.this[TKey key].set -> void -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Clear() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Clear() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary! TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Contains(System.Collections.Generic.KeyValuePair pair) -> bool TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.ContainsKey(TKey key) -> bool TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.ContainsValue(TValue value) -> bool @@ -198,7 +189,6 @@ TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Enumerator TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Enumerator.Current.get -> System.Collections.Generic.KeyValuePair TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Enumerator.Dispose() -> void -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Enumerator.Enumerator() -> void TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Enumerator.MoveNext() -> bool TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Enumerator.Reset() -> void TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.GetEnumerator() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Enumerator @@ -209,18 +199,16 @@ TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.KeyCollection.Enumerator TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.KeyCollection.Enumerator.Current.get -> TKey TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.KeyCollection.Enumerator.Dispose() -> void -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.KeyCollection.Enumerator.Enumerator() -> void TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.KeyCollection.Enumerator.MoveNext() -> bool TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.KeyCollection.Enumerator.Reset() -> void TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.KeyCollection.GetEnumerator() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.KeyCollection.Enumerator -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.KeyCollection.KeyCollection() -> void -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.KeyComparer.get -> System.Collections.Generic.IEqualityComparer +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.KeyComparer.get -> System.Collections.Generic.IEqualityComparer! TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Keys.get -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.KeyCollection -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Remove(TKey key) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.RemoveRange(System.Collections.Generic.IEnumerable keys) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.SetItem(TKey key, TValue value) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.SetItems(System.Collections.Generic.IEnumerable> items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.ToBuilder() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Builder +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Remove(TKey key) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.RemoveRange(System.Collections.Generic.IEnumerable! keys) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.SetItem(TKey key, TValue value) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.SetItems(System.Collections.Generic.IEnumerable>! items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.ToBuilder() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Builder! TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.TryGetKey(TKey equalKey, out TKey actualKey) -> bool TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.TryGetValue(TKey key, out TValue value) -> bool TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.ValueCollection @@ -229,208 +217,201 @@ TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.ValueCollection.Enumerator TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.ValueCollection.Enumerator.Current.get -> TValue TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.ValueCollection.Enumerator.Dispose() -> void -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.ValueCollection.Enumerator.Enumerator() -> void TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.ValueCollection.Enumerator.MoveNext() -> bool TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.ValueCollection.Enumerator.Reset() -> void TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.ValueCollection.GetEnumerator() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.ValueCollection.Enumerator -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.ValueCollection.ValueCollection() -> void -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.ValueComparer.get -> System.Collections.Generic.IEqualityComparer +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.ValueComparer.get -> System.Collections.Generic.IEqualityComparer! TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Values.get -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.ValueCollection -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.WithComparers(System.Collections.Generic.IEqualityComparer keyComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.WithComparers(System.Collections.Generic.IEqualityComparer keyComparer, System.Collections.Generic.IEqualityComparer valueComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.WithComparers(System.Collections.Generic.IEqualityComparer? keyComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.WithComparers(System.Collections.Generic.IEqualityComparer? keyComparer, System.Collections.Generic.IEqualityComparer? valueComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary! TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.this[TKey key].get -> TValue TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Add(T value) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.AddRange(System.Collections.Generic.IEnumerable items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Add(T value) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.AddRange(System.Collections.Generic.IEnumerable! items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList! TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.BinarySearch(T item) -> int -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.BinarySearch(T item, System.Collections.Generic.IComparer comparer) -> int -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.BinarySearch(int index, int count, T item, System.Collections.Generic.IComparer comparer) -> int +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.BinarySearch(T item, System.Collections.Generic.IComparer? comparer) -> int +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.BinarySearch(int index, int count, T item, System.Collections.Generic.IComparer? comparer) -> int TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.Add(T item) -> void -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.AddRange(System.Collections.Generic.IEnumerable items) -> void +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.AddRange(System.Collections.Generic.IEnumerable! items) -> void TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.BinarySearch(T item) -> int -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.BinarySearch(T item, System.Collections.Generic.IComparer comparer) -> int -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.BinarySearch(int index, int count, T item, System.Collections.Generic.IComparer comparer) -> int +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.BinarySearch(T item, System.Collections.Generic.IComparer? comparer) -> int +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.BinarySearch(int index, int count, T item, System.Collections.Generic.IComparer? comparer) -> int TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.Clear() -> void TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.Contains(T item) -> bool -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.ConvertAll(System.Func converter) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.CopyTo(T[] array) -> void -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.CopyTo(T[] array, int arrayIndex) -> void -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.CopyTo(int index, T[] array, int arrayIndex, int count) -> void +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.ConvertAll(System.Func! converter) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.CopyTo(T[]! array) -> void +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.CopyTo(T[]! array, int arrayIndex) -> void +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.CopyTo(int index, T[]! array, int arrayIndex, int count) -> void TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.Count.get -> int -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.Exists(System.Predicate match) -> bool -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.Find(System.Predicate match) -> T -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.FindAll(System.Predicate match) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.FindIndex(System.Predicate match) -> int -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.FindIndex(int startIndex, System.Predicate match) -> int -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.FindIndex(int startIndex, int count, System.Predicate match) -> int -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.FindLast(System.Predicate match) -> T -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.FindLastIndex(System.Predicate match) -> int -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.FindLastIndex(int startIndex, System.Predicate match) -> int -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.FindLastIndex(int startIndex, int count, System.Predicate match) -> int -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.ForEach(System.Action action) -> void +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.Exists(System.Predicate! match) -> bool +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.Find(System.Predicate! match) -> T +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.FindAll(System.Predicate! match) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.FindIndex(System.Predicate! match) -> int +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.FindIndex(int startIndex, System.Predicate! match) -> int +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.FindIndex(int startIndex, int count, System.Predicate! match) -> int +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.FindLast(System.Predicate! match) -> T +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.FindLastIndex(System.Predicate! match) -> int +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.FindLastIndex(int startIndex, System.Predicate! match) -> int +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.FindLastIndex(int startIndex, int count, System.Predicate! match) -> int +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.ForEach(System.Action! action) -> void TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.GetEnumerator() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Enumerator -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.GetRange(int index, int count) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.GetRange(int index, int count) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList! TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.IndexOf(T item) -> int TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.IndexOf(T item, int index) -> int TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.IndexOf(T item, int index, int count) -> int -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.IndexOf(T item, int index, int count, System.Collections.Generic.IEqualityComparer equalityComparer) -> int +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.IndexOf(T item, int index, int count, System.Collections.Generic.IEqualityComparer? equalityComparer) -> int TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.Insert(int index, T item) -> void -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.InsertRange(int index, System.Collections.Generic.IEnumerable items) -> void +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.InsertRange(int index, System.Collections.Generic.IEnumerable! items) -> void TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.LastIndexOf(T item) -> int TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.LastIndexOf(T item, int startIndex) -> int TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.LastIndexOf(T item, int startIndex, int count) -> int -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.LastIndexOf(T item, int startIndex, int count, System.Collections.Generic.IEqualityComparer equalityComparer) -> int +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.LastIndexOf(T item, int startIndex, int count, System.Collections.Generic.IEqualityComparer? equalityComparer) -> int TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.Remove(T item) -> bool -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.RemoveAll(System.Predicate match) -> int +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.RemoveAll(System.Predicate! match) -> int TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.RemoveAt(int index) -> void TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.Reverse() -> void TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.Reverse(int index, int count) -> void TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.Sort() -> void -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.Sort(System.Collections.Generic.IComparer comparer) -> void -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.Sort(System.Comparison comparison) -> void -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.Sort(int index, int count, System.Collections.Generic.IComparer comparer) -> void -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.ToImmutable() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.TrueForAll(System.Predicate match) -> bool +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.Sort(System.Collections.Generic.IComparer? comparer) -> void +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.Sort(System.Comparison! comparison) -> void +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.Sort(int index, int count, System.Collections.Generic.IComparer? comparer) -> void +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.ToImmutable() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.TrueForAll(System.Predicate! match) -> bool TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.this[int index].get -> T TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder.this[int index].set -> void -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Clear() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Clear() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList! TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Contains(T value) -> bool -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.ConvertAll(System.Func converter) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.CopyTo(T[] array) -> void -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.CopyTo(T[] array, int arrayIndex) -> void -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.CopyTo(int index, T[] array, int arrayIndex, int count) -> void +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.ConvertAll(System.Func! converter) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.CopyTo(T[]! array) -> void +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.CopyTo(T[]! array, int arrayIndex) -> void +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.CopyTo(int index, T[]! array, int arrayIndex, int count) -> void TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Count.get -> int TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Enumerator TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Enumerator.Current.get -> T TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Enumerator.Dispose() -> void -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Enumerator.Enumerator() -> void TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Enumerator.MoveNext() -> bool TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Enumerator.Reset() -> void -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Exists(System.Predicate match) -> bool -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Find(System.Predicate match) -> T -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.FindAll(System.Predicate match) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.FindIndex(System.Predicate match) -> int -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.FindIndex(int startIndex, System.Predicate match) -> int -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.FindIndex(int startIndex, int count, System.Predicate match) -> int -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.FindLast(System.Predicate match) -> T -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.FindLastIndex(System.Predicate match) -> int -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.FindLastIndex(int startIndex, System.Predicate match) -> int -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.FindLastIndex(int startIndex, int count, System.Predicate match) -> int -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.ForEach(System.Action action) -> void +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Exists(System.Predicate! match) -> bool +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Find(System.Predicate! match) -> T +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.FindAll(System.Predicate! match) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.FindIndex(System.Predicate! match) -> int +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.FindIndex(int startIndex, System.Predicate! match) -> int +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.FindIndex(int startIndex, int count, System.Predicate! match) -> int +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.FindLast(System.Predicate! match) -> T +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.FindLastIndex(System.Predicate! match) -> int +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.FindLastIndex(int startIndex, System.Predicate! match) -> int +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.FindLastIndex(int startIndex, int count, System.Predicate! match) -> int +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.ForEach(System.Action! action) -> void TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.GetEnumerator() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Enumerator -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.GetRange(int index, int count) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.IndexOf(T item, int index, int count, System.Collections.Generic.IEqualityComparer equalityComparer) -> int +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.GetRange(int index, int count) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.IndexOf(T item, int index, int count, System.Collections.Generic.IEqualityComparer? equalityComparer) -> int TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.IndexOf(T value) -> int -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Insert(int index, T item) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.InsertRange(int index, System.Collections.Generic.IEnumerable items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Insert(int index, T item) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.InsertRange(int index, System.Collections.Generic.IEnumerable! items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList! TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.IsEmpty.get -> bool -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.LastIndexOf(T item, int index, int count, System.Collections.Generic.IEqualityComparer equalityComparer) -> int -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Remove(T value) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Remove(T value, System.Collections.Generic.IEqualityComparer equalityComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.RemoveAll(System.Predicate match) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.RemoveAt(int index) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.RemoveRange(System.Collections.Generic.IEnumerable items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.RemoveRange(System.Collections.Generic.IEnumerable items, System.Collections.Generic.IEqualityComparer equalityComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.RemoveRange(int index, int count) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Replace(T oldValue, T newValue) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Replace(T oldValue, T newValue, System.Collections.Generic.IEqualityComparer equalityComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Reverse() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Reverse(int index, int count) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.SetItem(int index, T value) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Sort() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Sort(System.Collections.Generic.IComparer comparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Sort(System.Comparison comparison) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Sort(int index, int count, System.Collections.Generic.IComparer comparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.ToBuilder() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.TrueForAll(System.Predicate match) -> bool +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.LastIndexOf(T item, int index, int count, System.Collections.Generic.IEqualityComparer? equalityComparer) -> int +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Remove(T value) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Remove(T value, System.Collections.Generic.IEqualityComparer? equalityComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.RemoveAll(System.Predicate! match) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.RemoveAt(int index) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.RemoveRange(System.Collections.Generic.IEnumerable! items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.RemoveRange(System.Collections.Generic.IEnumerable! items, System.Collections.Generic.IEqualityComparer? equalityComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.RemoveRange(int index, int count) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Replace(T oldValue, T newValue) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Replace(T oldValue, T newValue, System.Collections.Generic.IEqualityComparer? equalityComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Reverse() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Reverse(int index, int count) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.SetItem(int index, T value) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Sort() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Sort(System.Collections.Generic.IComparer? comparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Sort(System.Comparison! comparison) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Sort(int index, int count, System.Collections.Generic.IComparer? comparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.ToBuilder() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.TrueForAll(System.Predicate! match) -> bool TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.this[int index].get -> T TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeQueue TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeQueue -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeQueue.Clear() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeQueue -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeQueue.Dequeue() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeQueue -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeQueue.Dequeue(out T value) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeQueue -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeQueue.Enqueue(T value) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeQueue +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeQueue.Clear() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeQueue! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeQueue.Dequeue() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeQueue! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeQueue.Dequeue(out T value) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeQueue! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeQueue.Enqueue(T value) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeQueue! TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeQueue.Enumerator TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeQueue.Enumerator.Current.get -> T -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeQueue.Enumerator.Enumerator() -> void TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeQueue.Enumerator.MoveNext() -> bool TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeQueue.GetEnumerator() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeQueue.Enumerator TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeQueue.IsEmpty.get -> bool TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeQueue.Peek() -> T TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Add(T value) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Add(T value) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet! TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Builder TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Builder.Add(T item) -> bool TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Builder.Clear() -> void TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Builder.Contains(T item) -> bool TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Builder.Count.get -> int -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Builder.ExceptWith(System.Collections.Generic.IEnumerable other) -> void +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Builder.ExceptWith(System.Collections.Generic.IEnumerable! other) -> void TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Builder.GetEnumerator() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Enumerator -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Builder.IntersectWith(System.Collections.Generic.IEnumerable other) -> void -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Builder.IsProperSubsetOf(System.Collections.Generic.IEnumerable other) -> bool -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Builder.IsProperSupersetOf(System.Collections.Generic.IEnumerable other) -> bool -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Builder.IsSubsetOf(System.Collections.Generic.IEnumerable other) -> bool -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Builder.IsSupersetOf(System.Collections.Generic.IEnumerable other) -> bool -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Builder.KeyComparer.get -> System.Collections.Generic.IEqualityComparer -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Builder.Overlaps(System.Collections.Generic.IEnumerable other) -> bool +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Builder.IntersectWith(System.Collections.Generic.IEnumerable! other) -> void +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Builder.IsProperSubsetOf(System.Collections.Generic.IEnumerable! other) -> bool +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Builder.IsProperSupersetOf(System.Collections.Generic.IEnumerable! other) -> bool +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Builder.IsSubsetOf(System.Collections.Generic.IEnumerable! other) -> bool +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Builder.IsSupersetOf(System.Collections.Generic.IEnumerable! other) -> bool +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Builder.KeyComparer.get -> System.Collections.Generic.IEqualityComparer! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Builder.Overlaps(System.Collections.Generic.IEnumerable! other) -> bool TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Builder.Remove(T item) -> bool -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Builder.SetEquals(System.Collections.Generic.IEnumerable other) -> bool -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Builder.SymmetricExceptWith(System.Collections.Generic.IEnumerable other) -> void -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Builder.ToImmutable() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Builder.UnionWith(System.Collections.Generic.IEnumerable other) -> void -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Clear() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Builder.SetEquals(System.Collections.Generic.IEnumerable! other) -> bool +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Builder.SymmetricExceptWith(System.Collections.Generic.IEnumerable! other) -> void +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Builder.ToImmutable() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Builder.UnionWith(System.Collections.Generic.IEnumerable! other) -> void +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Clear() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet! TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Contains(T value) -> bool TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Count.get -> int TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Enumerator TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Enumerator.Current.get -> T TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Enumerator.Dispose() -> void -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Enumerator.Enumerator() -> void TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Enumerator.MoveNext() -> bool TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Enumerator.Reset() -> void -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Except(System.Collections.Generic.IEnumerable other) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Except(System.Collections.Generic.IEnumerable! other) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet! TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.GetEnumerator() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Enumerator -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Intersect(System.Collections.Generic.IEnumerable other) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Intersect(System.Collections.Generic.IEnumerable! other) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet! TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.IsEmpty.get -> bool -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.IsProperSubsetOf(System.Collections.Generic.IEnumerable other) -> bool -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.IsProperSupersetOf(System.Collections.Generic.IEnumerable other) -> bool -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.IsSubsetOf(System.Collections.Generic.IEnumerable other) -> bool -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.IsSupersetOf(System.Collections.Generic.IEnumerable other) -> bool -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.KeyComparer.get -> System.Collections.Generic.IEqualityComparer -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Overlaps(System.Collections.Generic.IEnumerable other) -> bool -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Remove(T value) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.SetEquals(System.Collections.Generic.IEnumerable other) -> bool -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.SymmetricExcept(System.Collections.Generic.IEnumerable other) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.ToBuilder() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Builder +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.IsProperSubsetOf(System.Collections.Generic.IEnumerable! other) -> bool +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.IsProperSupersetOf(System.Collections.Generic.IEnumerable! other) -> bool +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.IsSubsetOf(System.Collections.Generic.IEnumerable! other) -> bool +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.IsSupersetOf(System.Collections.Generic.IEnumerable! other) -> bool +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.KeyComparer.get -> System.Collections.Generic.IEqualityComparer! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Overlaps(System.Collections.Generic.IEnumerable! other) -> bool +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Remove(T value) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.SetEquals(System.Collections.Generic.IEnumerable! other) -> bool +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.SymmetricExcept(System.Collections.Generic.IEnumerable! other) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.ToBuilder() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Builder! TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.TryGetValue(T equalValue, out T actualValue) -> bool -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Union(System.Collections.Generic.IEnumerable other) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.WithComparer(System.Collections.Generic.IEqualityComparer equalityComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Union(System.Collections.Generic.IEnumerable! other) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.WithComparer(System.Collections.Generic.IEqualityComparer? equalityComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet! TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeStack TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeStack -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeStack.Clear() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeStack +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeStack.Clear() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeStack! TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeStack.Enumerator TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeStack.Enumerator.Current.get -> T -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeStack.Enumerator.Enumerator() -> void TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeStack.Enumerator.MoveNext() -> bool TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeStack.GetEnumerator() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeStack.Enumerator TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeStack.IsEmpty.get -> bool TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeStack.Peek() -> T -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeStack.Pop() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeStack -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeStack.Pop(out T value) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeStack -TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeStack.Push(T value) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeStack +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeStack.Pop() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeStack! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeStack.Pop(out T value) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeStack! +TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeStack.Push(T value) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeStack! TunnelVisionLabs.Collections.Trees.SortedTreeDictionary TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.Add(TKey key, TValue value) -> void TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.Clear() -> void -TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.Comparer.get -> System.Collections.Generic.IComparer +TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.Comparer.get -> System.Collections.Generic.IComparer! TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.ContainsKey(TKey key) -> bool TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.ContainsValue(TValue value) -> bool TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.Count.get -> int TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.Enumerator TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.Enumerator.Current.get -> System.Collections.Generic.KeyValuePair TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.Enumerator.Dispose() -> void -TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.Enumerator.Enumerator() -> void TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.Enumerator.MoveNext() -> bool TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.GetEnumerator() -> TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.Enumerator TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.IndexOfKey(TKey key) -> int @@ -438,72 +419,67 @@ TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.IndexOfVal TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.KeyCollection TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.KeyCollection.Clear() -> void TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.KeyCollection.Contains(TKey item) -> bool -TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.KeyCollection.CopyTo(TKey[] array, int arrayIndex) -> void +TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.KeyCollection.CopyTo(TKey[]! array, int arrayIndex) -> void TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.KeyCollection.Count.get -> int TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.KeyCollection.Enumerator TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.KeyCollection.Enumerator.Current.get -> TKey TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.KeyCollection.Enumerator.Dispose() -> void -TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.KeyCollection.Enumerator.Enumerator() -> void TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.KeyCollection.Enumerator.MoveNext() -> bool TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.KeyCollection.GetEnumerator() -> TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.KeyCollection.Enumerator -TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.KeyCollection.KeyCollection() -> void TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.KeyCollection.Remove(TKey item) -> bool TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.Keys.get -> TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.KeyCollection TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.Remove(TKey key) -> bool TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.SortedTreeDictionary() -> void -TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.SortedTreeDictionary(System.Collections.Generic.IComparer comparer) -> void -TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.SortedTreeDictionary(System.Collections.Generic.IEnumerable> collection) -> void -TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.SortedTreeDictionary(System.Collections.Generic.IEnumerable> collection, System.Collections.Generic.IComparer comparer) -> void +TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.SortedTreeDictionary(System.Collections.Generic.IComparer? comparer) -> void +TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.SortedTreeDictionary(System.Collections.Generic.IEnumerable>! collection) -> void +TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.SortedTreeDictionary(System.Collections.Generic.IEnumerable>! collection, System.Collections.Generic.IComparer? comparer) -> void TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.SortedTreeDictionary(int branchingFactor) -> void -TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.SortedTreeDictionary(int branchingFactor, System.Collections.Generic.IComparer comparer) -> void -TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.SortedTreeDictionary(int branchingFactor, System.Collections.Generic.IEnumerable> collection, System.Collections.Generic.IComparer comparer) -> void +TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.SortedTreeDictionary(int branchingFactor, System.Collections.Generic.IComparer? comparer) -> void +TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.SortedTreeDictionary(int branchingFactor, System.Collections.Generic.IEnumerable>! collection, System.Collections.Generic.IComparer? comparer) -> void TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.TryAdd(TKey key, TValue value) -> bool TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.TryGetValue(TKey key, out TValue value) -> bool TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.ValueCollection TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.ValueCollection.Clear() -> void TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.ValueCollection.Contains(TValue item) -> bool -TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.ValueCollection.CopyTo(TValue[] array, int arrayIndex) -> void +TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.ValueCollection.CopyTo(TValue[]! array, int arrayIndex) -> void TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.ValueCollection.Count.get -> int TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.ValueCollection.Enumerator TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.ValueCollection.Enumerator.Current.get -> TValue TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.ValueCollection.Enumerator.Dispose() -> void -TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.ValueCollection.Enumerator.Enumerator() -> void TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.ValueCollection.Enumerator.MoveNext() -> bool TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.ValueCollection.GetEnumerator() -> TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.ValueCollection.Enumerator -TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.ValueCollection.ValueCollection() -> void TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.Values.get -> TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.ValueCollection TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.this[TKey key].get -> TValue TunnelVisionLabs.Collections.Trees.SortedTreeDictionary.this[TKey key].set -> void TunnelVisionLabs.Collections.Trees.SortedTreeList TunnelVisionLabs.Collections.Trees.SortedTreeList.Add(T item) -> void -TunnelVisionLabs.Collections.Trees.SortedTreeList.AddRange(System.Collections.Generic.IEnumerable collection) -> void +TunnelVisionLabs.Collections.Trees.SortedTreeList.AddRange(System.Collections.Generic.IEnumerable! collection) -> void TunnelVisionLabs.Collections.Trees.SortedTreeList.BinarySearch(T item) -> int TunnelVisionLabs.Collections.Trees.SortedTreeList.BinarySearch(int index, int count, T item) -> int TunnelVisionLabs.Collections.Trees.SortedTreeList.Clear() -> void -TunnelVisionLabs.Collections.Trees.SortedTreeList.Comparer.get -> System.Collections.Generic.IComparer +TunnelVisionLabs.Collections.Trees.SortedTreeList.Comparer.get -> System.Collections.Generic.IComparer! TunnelVisionLabs.Collections.Trees.SortedTreeList.Contains(T item) -> bool -TunnelVisionLabs.Collections.Trees.SortedTreeList.CopyTo(T[] array) -> void -TunnelVisionLabs.Collections.Trees.SortedTreeList.CopyTo(T[] array, int arrayIndex) -> void -TunnelVisionLabs.Collections.Trees.SortedTreeList.CopyTo(int index, T[] array, int arrayIndex, int count) -> void +TunnelVisionLabs.Collections.Trees.SortedTreeList.CopyTo(T[]! array) -> void +TunnelVisionLabs.Collections.Trees.SortedTreeList.CopyTo(T[]! array, int arrayIndex) -> void +TunnelVisionLabs.Collections.Trees.SortedTreeList.CopyTo(int index, T[]! array, int arrayIndex, int count) -> void TunnelVisionLabs.Collections.Trees.SortedTreeList.Count.get -> int TunnelVisionLabs.Collections.Trees.SortedTreeList.Enumerator TunnelVisionLabs.Collections.Trees.SortedTreeList.Enumerator.Current.get -> T TunnelVisionLabs.Collections.Trees.SortedTreeList.Enumerator.Dispose() -> void -TunnelVisionLabs.Collections.Trees.SortedTreeList.Enumerator.Enumerator() -> void TunnelVisionLabs.Collections.Trees.SortedTreeList.Enumerator.MoveNext() -> bool -TunnelVisionLabs.Collections.Trees.SortedTreeList.Exists(System.Predicate match) -> bool -TunnelVisionLabs.Collections.Trees.SortedTreeList.Find(System.Predicate match) -> T -TunnelVisionLabs.Collections.Trees.SortedTreeList.FindAll(System.Predicate match) -> TunnelVisionLabs.Collections.Trees.SortedTreeList -TunnelVisionLabs.Collections.Trees.SortedTreeList.FindIndex(System.Predicate match) -> int -TunnelVisionLabs.Collections.Trees.SortedTreeList.FindIndex(int startIndex, System.Predicate match) -> int -TunnelVisionLabs.Collections.Trees.SortedTreeList.FindIndex(int startIndex, int count, System.Predicate match) -> int -TunnelVisionLabs.Collections.Trees.SortedTreeList.FindLast(System.Predicate match) -> T -TunnelVisionLabs.Collections.Trees.SortedTreeList.FindLastIndex(System.Predicate match) -> int -TunnelVisionLabs.Collections.Trees.SortedTreeList.FindLastIndex(int startIndex, System.Predicate match) -> int -TunnelVisionLabs.Collections.Trees.SortedTreeList.FindLastIndex(int startIndex, int count, System.Predicate match) -> int -TunnelVisionLabs.Collections.Trees.SortedTreeList.ForEach(System.Action action) -> void +TunnelVisionLabs.Collections.Trees.SortedTreeList.Exists(System.Predicate! match) -> bool +TunnelVisionLabs.Collections.Trees.SortedTreeList.Find(System.Predicate! match) -> T +TunnelVisionLabs.Collections.Trees.SortedTreeList.FindAll(System.Predicate! match) -> TunnelVisionLabs.Collections.Trees.SortedTreeList! +TunnelVisionLabs.Collections.Trees.SortedTreeList.FindIndex(System.Predicate! match) -> int +TunnelVisionLabs.Collections.Trees.SortedTreeList.FindIndex(int startIndex, System.Predicate! match) -> int +TunnelVisionLabs.Collections.Trees.SortedTreeList.FindIndex(int startIndex, int count, System.Predicate! match) -> int +TunnelVisionLabs.Collections.Trees.SortedTreeList.FindLast(System.Predicate! match) -> T +TunnelVisionLabs.Collections.Trees.SortedTreeList.FindLastIndex(System.Predicate! match) -> int +TunnelVisionLabs.Collections.Trees.SortedTreeList.FindLastIndex(int startIndex, System.Predicate! match) -> int +TunnelVisionLabs.Collections.Trees.SortedTreeList.FindLastIndex(int startIndex, int count, System.Predicate! match) -> int +TunnelVisionLabs.Collections.Trees.SortedTreeList.ForEach(System.Action! action) -> void TunnelVisionLabs.Collections.Trees.SortedTreeList.GetEnumerator() -> TunnelVisionLabs.Collections.Trees.SortedTreeList.Enumerator -TunnelVisionLabs.Collections.Trees.SortedTreeList.GetRange(int index, int count) -> TunnelVisionLabs.Collections.Trees.SortedTreeList +TunnelVisionLabs.Collections.Trees.SortedTreeList.GetRange(int index, int count) -> TunnelVisionLabs.Collections.Trees.SortedTreeList! TunnelVisionLabs.Collections.Trees.SortedTreeList.IndexOf(T item) -> int TunnelVisionLabs.Collections.Trees.SortedTreeList.IndexOf(T item, int index) -> int TunnelVisionLabs.Collections.Trees.SortedTreeList.IndexOf(T item, int index, int count) -> int @@ -511,183 +487,175 @@ TunnelVisionLabs.Collections.Trees.SortedTreeList.LastIndexOf(T item) -> int TunnelVisionLabs.Collections.Trees.SortedTreeList.LastIndexOf(T item, int index) -> int TunnelVisionLabs.Collections.Trees.SortedTreeList.LastIndexOf(T item, int index, int count) -> int TunnelVisionLabs.Collections.Trees.SortedTreeList.Remove(T item) -> bool -TunnelVisionLabs.Collections.Trees.SortedTreeList.RemoveAll(System.Predicate match) -> int +TunnelVisionLabs.Collections.Trees.SortedTreeList.RemoveAll(System.Predicate! match) -> int TunnelVisionLabs.Collections.Trees.SortedTreeList.RemoveAt(int index) -> void TunnelVisionLabs.Collections.Trees.SortedTreeList.RemoveRange(int index, int count) -> void TunnelVisionLabs.Collections.Trees.SortedTreeList.SortedTreeList() -> void -TunnelVisionLabs.Collections.Trees.SortedTreeList.SortedTreeList(System.Collections.Generic.IComparer comparer) -> void -TunnelVisionLabs.Collections.Trees.SortedTreeList.SortedTreeList(System.Collections.Generic.IEnumerable collection) -> void -TunnelVisionLabs.Collections.Trees.SortedTreeList.SortedTreeList(System.Collections.Generic.IEnumerable collection, System.Collections.Generic.IComparer comparer) -> void +TunnelVisionLabs.Collections.Trees.SortedTreeList.SortedTreeList(System.Collections.Generic.IComparer? comparer) -> void +TunnelVisionLabs.Collections.Trees.SortedTreeList.SortedTreeList(System.Collections.Generic.IEnumerable! collection) -> void +TunnelVisionLabs.Collections.Trees.SortedTreeList.SortedTreeList(System.Collections.Generic.IEnumerable! collection, System.Collections.Generic.IComparer? comparer) -> void TunnelVisionLabs.Collections.Trees.SortedTreeList.SortedTreeList(int branchingFactor) -> void -TunnelVisionLabs.Collections.Trees.SortedTreeList.SortedTreeList(int branchingFactor, System.Collections.Generic.IComparer comparer) -> void -TunnelVisionLabs.Collections.Trees.SortedTreeList.SortedTreeList(int branchingFactor, System.Collections.Generic.IEnumerable collection, System.Collections.Generic.IComparer comparer) -> void -TunnelVisionLabs.Collections.Trees.SortedTreeList.ToArray() -> T[] +TunnelVisionLabs.Collections.Trees.SortedTreeList.SortedTreeList(int branchingFactor, System.Collections.Generic.IComparer? comparer) -> void +TunnelVisionLabs.Collections.Trees.SortedTreeList.SortedTreeList(int branchingFactor, System.Collections.Generic.IEnumerable! collection, System.Collections.Generic.IComparer? comparer) -> void +TunnelVisionLabs.Collections.Trees.SortedTreeList.ToArray() -> T[]! TunnelVisionLabs.Collections.Trees.SortedTreeList.TrimExcess() -> void -TunnelVisionLabs.Collections.Trees.SortedTreeList.TrueForAll(System.Predicate match) -> bool +TunnelVisionLabs.Collections.Trees.SortedTreeList.TrueForAll(System.Predicate! match) -> bool TunnelVisionLabs.Collections.Trees.SortedTreeList.this[int index].get -> T TunnelVisionLabs.Collections.Trees.SortedTreeSet TunnelVisionLabs.Collections.Trees.SortedTreeSet.Add(T item) -> bool TunnelVisionLabs.Collections.Trees.SortedTreeSet.Clear() -> void -TunnelVisionLabs.Collections.Trees.SortedTreeSet.Comparer.get -> System.Collections.Generic.IComparer +TunnelVisionLabs.Collections.Trees.SortedTreeSet.Comparer.get -> System.Collections.Generic.IComparer! TunnelVisionLabs.Collections.Trees.SortedTreeSet.Contains(T item) -> bool -TunnelVisionLabs.Collections.Trees.SortedTreeSet.CopyTo(T[] array) -> void -TunnelVisionLabs.Collections.Trees.SortedTreeSet.CopyTo(T[] array, int arrayIndex) -> void -TunnelVisionLabs.Collections.Trees.SortedTreeSet.CopyTo(T[] array, int arrayIndex, int count) -> void +TunnelVisionLabs.Collections.Trees.SortedTreeSet.CopyTo(T[]! array) -> void +TunnelVisionLabs.Collections.Trees.SortedTreeSet.CopyTo(T[]! array, int arrayIndex) -> void +TunnelVisionLabs.Collections.Trees.SortedTreeSet.CopyTo(T[]! array, int arrayIndex, int count) -> void TunnelVisionLabs.Collections.Trees.SortedTreeSet.Count.get -> int TunnelVisionLabs.Collections.Trees.SortedTreeSet.Enumerator TunnelVisionLabs.Collections.Trees.SortedTreeSet.Enumerator.Current.get -> T TunnelVisionLabs.Collections.Trees.SortedTreeSet.Enumerator.Dispose() -> void -TunnelVisionLabs.Collections.Trees.SortedTreeSet.Enumerator.Enumerator() -> void TunnelVisionLabs.Collections.Trees.SortedTreeSet.Enumerator.MoveNext() -> bool -TunnelVisionLabs.Collections.Trees.SortedTreeSet.ExceptWith(System.Collections.Generic.IEnumerable other) -> void +TunnelVisionLabs.Collections.Trees.SortedTreeSet.ExceptWith(System.Collections.Generic.IEnumerable! other) -> void TunnelVisionLabs.Collections.Trees.SortedTreeSet.GetEnumerator() -> TunnelVisionLabs.Collections.Trees.SortedTreeSet.Enumerator -TunnelVisionLabs.Collections.Trees.SortedTreeSet.IntersectWith(System.Collections.Generic.IEnumerable other) -> void -TunnelVisionLabs.Collections.Trees.SortedTreeSet.IsProperSubsetOf(System.Collections.Generic.IEnumerable other) -> bool -TunnelVisionLabs.Collections.Trees.SortedTreeSet.IsProperSupersetOf(System.Collections.Generic.IEnumerable other) -> bool -TunnelVisionLabs.Collections.Trees.SortedTreeSet.IsSubsetOf(System.Collections.Generic.IEnumerable other) -> bool -TunnelVisionLabs.Collections.Trees.SortedTreeSet.IsSupersetOf(System.Collections.Generic.IEnumerable other) -> bool +TunnelVisionLabs.Collections.Trees.SortedTreeSet.IntersectWith(System.Collections.Generic.IEnumerable! other) -> void +TunnelVisionLabs.Collections.Trees.SortedTreeSet.IsProperSubsetOf(System.Collections.Generic.IEnumerable! other) -> bool +TunnelVisionLabs.Collections.Trees.SortedTreeSet.IsProperSupersetOf(System.Collections.Generic.IEnumerable! other) -> bool +TunnelVisionLabs.Collections.Trees.SortedTreeSet.IsSubsetOf(System.Collections.Generic.IEnumerable! other) -> bool +TunnelVisionLabs.Collections.Trees.SortedTreeSet.IsSupersetOf(System.Collections.Generic.IEnumerable! other) -> bool TunnelVisionLabs.Collections.Trees.SortedTreeSet.Max.get -> T TunnelVisionLabs.Collections.Trees.SortedTreeSet.Min.get -> T -TunnelVisionLabs.Collections.Trees.SortedTreeSet.Overlaps(System.Collections.Generic.IEnumerable other) -> bool +TunnelVisionLabs.Collections.Trees.SortedTreeSet.Overlaps(System.Collections.Generic.IEnumerable! other) -> bool TunnelVisionLabs.Collections.Trees.SortedTreeSet.Remove(T item) -> bool -TunnelVisionLabs.Collections.Trees.SortedTreeSet.RemoveWhere(System.Predicate match) -> int -TunnelVisionLabs.Collections.Trees.SortedTreeSet.SetEquals(System.Collections.Generic.IEnumerable other) -> bool +TunnelVisionLabs.Collections.Trees.SortedTreeSet.RemoveWhere(System.Predicate! match) -> int +TunnelVisionLabs.Collections.Trees.SortedTreeSet.SetEquals(System.Collections.Generic.IEnumerable! other) -> bool TunnelVisionLabs.Collections.Trees.SortedTreeSet.SortedTreeSet() -> void -TunnelVisionLabs.Collections.Trees.SortedTreeSet.SortedTreeSet(System.Collections.Generic.IComparer comparer) -> void -TunnelVisionLabs.Collections.Trees.SortedTreeSet.SortedTreeSet(System.Collections.Generic.IEnumerable collection) -> void -TunnelVisionLabs.Collections.Trees.SortedTreeSet.SortedTreeSet(System.Collections.Generic.IEnumerable collection, System.Collections.Generic.IComparer comparer) -> void +TunnelVisionLabs.Collections.Trees.SortedTreeSet.SortedTreeSet(System.Collections.Generic.IComparer? comparer) -> void +TunnelVisionLabs.Collections.Trees.SortedTreeSet.SortedTreeSet(System.Collections.Generic.IEnumerable! collection) -> void +TunnelVisionLabs.Collections.Trees.SortedTreeSet.SortedTreeSet(System.Collections.Generic.IEnumerable! collection, System.Collections.Generic.IComparer? comparer) -> void TunnelVisionLabs.Collections.Trees.SortedTreeSet.SortedTreeSet(int branchingFactor) -> void -TunnelVisionLabs.Collections.Trees.SortedTreeSet.SortedTreeSet(int branchingFactor, System.Collections.Generic.IComparer comparer) -> void -TunnelVisionLabs.Collections.Trees.SortedTreeSet.SortedTreeSet(int branchingFactor, System.Collections.Generic.IEnumerable collection, System.Collections.Generic.IComparer comparer) -> void -TunnelVisionLabs.Collections.Trees.SortedTreeSet.SymmetricExceptWith(System.Collections.Generic.IEnumerable other) -> void +TunnelVisionLabs.Collections.Trees.SortedTreeSet.SortedTreeSet(int branchingFactor, System.Collections.Generic.IComparer? comparer) -> void +TunnelVisionLabs.Collections.Trees.SortedTreeSet.SortedTreeSet(int branchingFactor, System.Collections.Generic.IEnumerable! collection, System.Collections.Generic.IComparer? comparer) -> void +TunnelVisionLabs.Collections.Trees.SortedTreeSet.SymmetricExceptWith(System.Collections.Generic.IEnumerable! other) -> void TunnelVisionLabs.Collections.Trees.SortedTreeSet.TrimExcess() -> void TunnelVisionLabs.Collections.Trees.SortedTreeSet.TryGetValue(T equalValue, out T actualValue) -> bool -TunnelVisionLabs.Collections.Trees.SortedTreeSet.UnionWith(System.Collections.Generic.IEnumerable other) -> void +TunnelVisionLabs.Collections.Trees.SortedTreeSet.UnionWith(System.Collections.Generic.IEnumerable! other) -> void TunnelVisionLabs.Collections.Trees.TreeDictionary TunnelVisionLabs.Collections.Trees.TreeDictionary.Add(TKey key, TValue value) -> void TunnelVisionLabs.Collections.Trees.TreeDictionary.Clear() -> void -TunnelVisionLabs.Collections.Trees.TreeDictionary.Comparer.get -> System.Collections.Generic.IEqualityComparer +TunnelVisionLabs.Collections.Trees.TreeDictionary.Comparer.get -> System.Collections.Generic.IEqualityComparer! TunnelVisionLabs.Collections.Trees.TreeDictionary.ContainsKey(TKey key) -> bool TunnelVisionLabs.Collections.Trees.TreeDictionary.ContainsValue(TValue value) -> bool TunnelVisionLabs.Collections.Trees.TreeDictionary.Count.get -> int TunnelVisionLabs.Collections.Trees.TreeDictionary.Enumerator TunnelVisionLabs.Collections.Trees.TreeDictionary.Enumerator.Current.get -> System.Collections.Generic.KeyValuePair TunnelVisionLabs.Collections.Trees.TreeDictionary.Enumerator.Dispose() -> void -TunnelVisionLabs.Collections.Trees.TreeDictionary.Enumerator.Enumerator() -> void TunnelVisionLabs.Collections.Trees.TreeDictionary.Enumerator.MoveNext() -> bool TunnelVisionLabs.Collections.Trees.TreeDictionary.GetEnumerator() -> TunnelVisionLabs.Collections.Trees.TreeDictionary.Enumerator TunnelVisionLabs.Collections.Trees.TreeDictionary.KeyCollection TunnelVisionLabs.Collections.Trees.TreeDictionary.KeyCollection.Clear() -> void TunnelVisionLabs.Collections.Trees.TreeDictionary.KeyCollection.Contains(TKey item) -> bool -TunnelVisionLabs.Collections.Trees.TreeDictionary.KeyCollection.CopyTo(TKey[] array, int arrayIndex) -> void +TunnelVisionLabs.Collections.Trees.TreeDictionary.KeyCollection.CopyTo(TKey[]! array, int arrayIndex) -> void TunnelVisionLabs.Collections.Trees.TreeDictionary.KeyCollection.Count.get -> int TunnelVisionLabs.Collections.Trees.TreeDictionary.KeyCollection.Enumerator TunnelVisionLabs.Collections.Trees.TreeDictionary.KeyCollection.Enumerator.Current.get -> TKey TunnelVisionLabs.Collections.Trees.TreeDictionary.KeyCollection.Enumerator.Dispose() -> void -TunnelVisionLabs.Collections.Trees.TreeDictionary.KeyCollection.Enumerator.Enumerator() -> void TunnelVisionLabs.Collections.Trees.TreeDictionary.KeyCollection.Enumerator.MoveNext() -> bool TunnelVisionLabs.Collections.Trees.TreeDictionary.KeyCollection.GetEnumerator() -> TunnelVisionLabs.Collections.Trees.TreeDictionary.KeyCollection.Enumerator -TunnelVisionLabs.Collections.Trees.TreeDictionary.KeyCollection.KeyCollection() -> void TunnelVisionLabs.Collections.Trees.TreeDictionary.KeyCollection.Remove(TKey item) -> bool TunnelVisionLabs.Collections.Trees.TreeDictionary.Keys.get -> TunnelVisionLabs.Collections.Trees.TreeDictionary.KeyCollection TunnelVisionLabs.Collections.Trees.TreeDictionary.Remove(TKey key) -> bool TunnelVisionLabs.Collections.Trees.TreeDictionary.TreeDictionary() -> void -TunnelVisionLabs.Collections.Trees.TreeDictionary.TreeDictionary(System.Collections.Generic.IEnumerable> collection) -> void -TunnelVisionLabs.Collections.Trees.TreeDictionary.TreeDictionary(System.Collections.Generic.IEnumerable> collection, System.Collections.Generic.IEqualityComparer comparer) -> void -TunnelVisionLabs.Collections.Trees.TreeDictionary.TreeDictionary(System.Collections.Generic.IEqualityComparer comparer) -> void +TunnelVisionLabs.Collections.Trees.TreeDictionary.TreeDictionary(System.Collections.Generic.IEnumerable>! collection) -> void +TunnelVisionLabs.Collections.Trees.TreeDictionary.TreeDictionary(System.Collections.Generic.IEnumerable>! collection, System.Collections.Generic.IEqualityComparer? comparer) -> void +TunnelVisionLabs.Collections.Trees.TreeDictionary.TreeDictionary(System.Collections.Generic.IEqualityComparer? comparer) -> void TunnelVisionLabs.Collections.Trees.TreeDictionary.TreeDictionary(int branchingFactor) -> void -TunnelVisionLabs.Collections.Trees.TreeDictionary.TreeDictionary(int branchingFactor, System.Collections.Generic.IEnumerable> collection, System.Collections.Generic.IEqualityComparer comparer) -> void -TunnelVisionLabs.Collections.Trees.TreeDictionary.TreeDictionary(int branchingFactor, System.Collections.Generic.IEqualityComparer comparer) -> void +TunnelVisionLabs.Collections.Trees.TreeDictionary.TreeDictionary(int branchingFactor, System.Collections.Generic.IEnumerable>! collection, System.Collections.Generic.IEqualityComparer? comparer) -> void +TunnelVisionLabs.Collections.Trees.TreeDictionary.TreeDictionary(int branchingFactor, System.Collections.Generic.IEqualityComparer? comparer) -> void TunnelVisionLabs.Collections.Trees.TreeDictionary.TryAdd(TKey key, TValue value) -> bool TunnelVisionLabs.Collections.Trees.TreeDictionary.TryGetValue(TKey key, out TValue value) -> bool TunnelVisionLabs.Collections.Trees.TreeDictionary.ValueCollection TunnelVisionLabs.Collections.Trees.TreeDictionary.ValueCollection.Clear() -> void TunnelVisionLabs.Collections.Trees.TreeDictionary.ValueCollection.Contains(TValue item) -> bool -TunnelVisionLabs.Collections.Trees.TreeDictionary.ValueCollection.CopyTo(TValue[] array, int arrayIndex) -> void +TunnelVisionLabs.Collections.Trees.TreeDictionary.ValueCollection.CopyTo(TValue[]! array, int arrayIndex) -> void TunnelVisionLabs.Collections.Trees.TreeDictionary.ValueCollection.Count.get -> int TunnelVisionLabs.Collections.Trees.TreeDictionary.ValueCollection.Enumerator TunnelVisionLabs.Collections.Trees.TreeDictionary.ValueCollection.Enumerator.Current.get -> TValue TunnelVisionLabs.Collections.Trees.TreeDictionary.ValueCollection.Enumerator.Dispose() -> void -TunnelVisionLabs.Collections.Trees.TreeDictionary.ValueCollection.Enumerator.Enumerator() -> void TunnelVisionLabs.Collections.Trees.TreeDictionary.ValueCollection.Enumerator.MoveNext() -> bool TunnelVisionLabs.Collections.Trees.TreeDictionary.ValueCollection.GetEnumerator() -> TunnelVisionLabs.Collections.Trees.TreeDictionary.ValueCollection.Enumerator -TunnelVisionLabs.Collections.Trees.TreeDictionary.ValueCollection.ValueCollection() -> void TunnelVisionLabs.Collections.Trees.TreeDictionary.Values.get -> TunnelVisionLabs.Collections.Trees.TreeDictionary.ValueCollection TunnelVisionLabs.Collections.Trees.TreeDictionary.this[TKey key].get -> TValue TunnelVisionLabs.Collections.Trees.TreeDictionary.this[TKey key].set -> void TunnelVisionLabs.Collections.Trees.TreeList TunnelVisionLabs.Collections.Trees.TreeList.Add(T item) -> void -TunnelVisionLabs.Collections.Trees.TreeList.AddRange(System.Collections.Generic.IEnumerable collection) -> void +TunnelVisionLabs.Collections.Trees.TreeList.AddRange(System.Collections.Generic.IEnumerable! collection) -> void TunnelVisionLabs.Collections.Trees.TreeList.BinarySearch(T item) -> int -TunnelVisionLabs.Collections.Trees.TreeList.BinarySearch(T item, System.Collections.Generic.IComparer comparer) -> int -TunnelVisionLabs.Collections.Trees.TreeList.BinarySearch(int index, int count, T item, System.Collections.Generic.IComparer comparer) -> int +TunnelVisionLabs.Collections.Trees.TreeList.BinarySearch(T item, System.Collections.Generic.IComparer? comparer) -> int +TunnelVisionLabs.Collections.Trees.TreeList.BinarySearch(int index, int count, T item, System.Collections.Generic.IComparer? comparer) -> int TunnelVisionLabs.Collections.Trees.TreeList.Clear() -> void TunnelVisionLabs.Collections.Trees.TreeList.Contains(T item) -> bool -TunnelVisionLabs.Collections.Trees.TreeList.ConvertAll(System.Func converter) -> TunnelVisionLabs.Collections.Trees.TreeList -TunnelVisionLabs.Collections.Trees.TreeList.CopyTo(T[] array) -> void -TunnelVisionLabs.Collections.Trees.TreeList.CopyTo(T[] array, int arrayIndex) -> void -TunnelVisionLabs.Collections.Trees.TreeList.CopyTo(int srcIndex, T[] dest, int dstIndex, int length) -> void +TunnelVisionLabs.Collections.Trees.TreeList.ConvertAll(System.Func! converter) -> TunnelVisionLabs.Collections.Trees.TreeList! +TunnelVisionLabs.Collections.Trees.TreeList.CopyTo(T[]! array) -> void +TunnelVisionLabs.Collections.Trees.TreeList.CopyTo(T[]! array, int arrayIndex) -> void +TunnelVisionLabs.Collections.Trees.TreeList.CopyTo(int srcIndex, T[]! dest, int dstIndex, int length) -> void TunnelVisionLabs.Collections.Trees.TreeList.Count.get -> int TunnelVisionLabs.Collections.Trees.TreeList.Enumerator TunnelVisionLabs.Collections.Trees.TreeList.Enumerator.Current.get -> T TunnelVisionLabs.Collections.Trees.TreeList.Enumerator.Dispose() -> void -TunnelVisionLabs.Collections.Trees.TreeList.Enumerator.Enumerator() -> void TunnelVisionLabs.Collections.Trees.TreeList.Enumerator.MoveNext() -> bool -TunnelVisionLabs.Collections.Trees.TreeList.Exists(System.Predicate match) -> bool -TunnelVisionLabs.Collections.Trees.TreeList.Find(System.Predicate match) -> T -TunnelVisionLabs.Collections.Trees.TreeList.FindAll(System.Predicate match) -> TunnelVisionLabs.Collections.Trees.TreeList -TunnelVisionLabs.Collections.Trees.TreeList.FindIndex(System.Predicate match) -> int -TunnelVisionLabs.Collections.Trees.TreeList.FindIndex(int startIndex, System.Predicate match) -> int -TunnelVisionLabs.Collections.Trees.TreeList.FindIndex(int startIndex, int count, System.Predicate match) -> int -TunnelVisionLabs.Collections.Trees.TreeList.FindLast(System.Predicate match) -> T -TunnelVisionLabs.Collections.Trees.TreeList.FindLastIndex(System.Predicate match) -> int -TunnelVisionLabs.Collections.Trees.TreeList.FindLastIndex(int startIndex, System.Predicate match) -> int -TunnelVisionLabs.Collections.Trees.TreeList.FindLastIndex(int startIndex, int count, System.Predicate match) -> int -TunnelVisionLabs.Collections.Trees.TreeList.ForEach(System.Action action) -> void +TunnelVisionLabs.Collections.Trees.TreeList.Exists(System.Predicate! match) -> bool +TunnelVisionLabs.Collections.Trees.TreeList.Find(System.Predicate! match) -> T +TunnelVisionLabs.Collections.Trees.TreeList.FindAll(System.Predicate! match) -> TunnelVisionLabs.Collections.Trees.TreeList! +TunnelVisionLabs.Collections.Trees.TreeList.FindIndex(System.Predicate! match) -> int +TunnelVisionLabs.Collections.Trees.TreeList.FindIndex(int startIndex, System.Predicate! match) -> int +TunnelVisionLabs.Collections.Trees.TreeList.FindIndex(int startIndex, int count, System.Predicate! match) -> int +TunnelVisionLabs.Collections.Trees.TreeList.FindLast(System.Predicate! match) -> T +TunnelVisionLabs.Collections.Trees.TreeList.FindLastIndex(System.Predicate! match) -> int +TunnelVisionLabs.Collections.Trees.TreeList.FindLastIndex(int startIndex, System.Predicate! match) -> int +TunnelVisionLabs.Collections.Trees.TreeList.FindLastIndex(int startIndex, int count, System.Predicate! match) -> int +TunnelVisionLabs.Collections.Trees.TreeList.ForEach(System.Action! action) -> void TunnelVisionLabs.Collections.Trees.TreeList.GetEnumerator() -> TunnelVisionLabs.Collections.Trees.TreeList.Enumerator -TunnelVisionLabs.Collections.Trees.TreeList.GetRange(int index, int count) -> TunnelVisionLabs.Collections.Trees.TreeList +TunnelVisionLabs.Collections.Trees.TreeList.GetRange(int index, int count) -> TunnelVisionLabs.Collections.Trees.TreeList! TunnelVisionLabs.Collections.Trees.TreeList.IndexOf(T item) -> int TunnelVisionLabs.Collections.Trees.TreeList.IndexOf(T item, int index) -> int TunnelVisionLabs.Collections.Trees.TreeList.IndexOf(T item, int index, int count) -> int TunnelVisionLabs.Collections.Trees.TreeList.Insert(int index, T item) -> void -TunnelVisionLabs.Collections.Trees.TreeList.InsertRange(int index, System.Collections.Generic.IEnumerable collection) -> void +TunnelVisionLabs.Collections.Trees.TreeList.InsertRange(int index, System.Collections.Generic.IEnumerable! collection) -> void TunnelVisionLabs.Collections.Trees.TreeList.LastIndexOf(T item) -> int TunnelVisionLabs.Collections.Trees.TreeList.LastIndexOf(T item, int index) -> int TunnelVisionLabs.Collections.Trees.TreeList.LastIndexOf(T item, int index, int count) -> int TunnelVisionLabs.Collections.Trees.TreeList.Remove(T item) -> bool -TunnelVisionLabs.Collections.Trees.TreeList.RemoveAll(System.Predicate match) -> int +TunnelVisionLabs.Collections.Trees.TreeList.RemoveAll(System.Predicate! match) -> int TunnelVisionLabs.Collections.Trees.TreeList.RemoveAt(int index) -> void TunnelVisionLabs.Collections.Trees.TreeList.RemoveRange(int index, int count) -> void TunnelVisionLabs.Collections.Trees.TreeList.Reverse() -> void TunnelVisionLabs.Collections.Trees.TreeList.Reverse(int index, int count) -> void TunnelVisionLabs.Collections.Trees.TreeList.Sort() -> void -TunnelVisionLabs.Collections.Trees.TreeList.Sort(System.Collections.Generic.IComparer comparer) -> void -TunnelVisionLabs.Collections.Trees.TreeList.Sort(System.Comparison comparison) -> void -TunnelVisionLabs.Collections.Trees.TreeList.Sort(int index, int count, System.Collections.Generic.IComparer comparer) -> void -TunnelVisionLabs.Collections.Trees.TreeList.ToArray() -> T[] +TunnelVisionLabs.Collections.Trees.TreeList.Sort(System.Collections.Generic.IComparer? comparer) -> void +TunnelVisionLabs.Collections.Trees.TreeList.Sort(System.Comparison! comparison) -> void +TunnelVisionLabs.Collections.Trees.TreeList.Sort(int index, int count, System.Collections.Generic.IComparer? comparer) -> void +TunnelVisionLabs.Collections.Trees.TreeList.ToArray() -> T[]! TunnelVisionLabs.Collections.Trees.TreeList.TreeList() -> void -TunnelVisionLabs.Collections.Trees.TreeList.TreeList(System.Collections.Generic.IEnumerable collection) -> void +TunnelVisionLabs.Collections.Trees.TreeList.TreeList(System.Collections.Generic.IEnumerable! collection) -> void TunnelVisionLabs.Collections.Trees.TreeList.TreeList(int branchingFactor) -> void -TunnelVisionLabs.Collections.Trees.TreeList.TreeList(int branchingFactor, System.Collections.Generic.IEnumerable collection) -> void +TunnelVisionLabs.Collections.Trees.TreeList.TreeList(int branchingFactor, System.Collections.Generic.IEnumerable! collection) -> void TunnelVisionLabs.Collections.Trees.TreeList.TrimExcess() -> void -TunnelVisionLabs.Collections.Trees.TreeList.TrueForAll(System.Predicate match) -> bool +TunnelVisionLabs.Collections.Trees.TreeList.TrueForAll(System.Predicate! match) -> bool TunnelVisionLabs.Collections.Trees.TreeList.this[int index].get -> T TunnelVisionLabs.Collections.Trees.TreeList.this[int index].set -> void TunnelVisionLabs.Collections.Trees.TreeQueue TunnelVisionLabs.Collections.Trees.TreeQueue.Clear() -> void TunnelVisionLabs.Collections.Trees.TreeQueue.Contains(T item) -> bool -TunnelVisionLabs.Collections.Trees.TreeQueue.CopyTo(T[] array, int arrayIndex) -> void +TunnelVisionLabs.Collections.Trees.TreeQueue.CopyTo(T[]! array, int arrayIndex) -> void TunnelVisionLabs.Collections.Trees.TreeQueue.Count.get -> int TunnelVisionLabs.Collections.Trees.TreeQueue.Dequeue() -> T TunnelVisionLabs.Collections.Trees.TreeQueue.Enqueue(T item) -> void TunnelVisionLabs.Collections.Trees.TreeQueue.Enumerator TunnelVisionLabs.Collections.Trees.TreeQueue.Enumerator.Current.get -> T TunnelVisionLabs.Collections.Trees.TreeQueue.Enumerator.Dispose() -> void -TunnelVisionLabs.Collections.Trees.TreeQueue.Enumerator.Enumerator() -> void TunnelVisionLabs.Collections.Trees.TreeQueue.Enumerator.MoveNext() -> bool TunnelVisionLabs.Collections.Trees.TreeQueue.GetEnumerator() -> TunnelVisionLabs.Collections.Trees.TreeQueue.Enumerator TunnelVisionLabs.Collections.Trees.TreeQueue.Peek() -> T -TunnelVisionLabs.Collections.Trees.TreeQueue.ToArray() -> T[] +TunnelVisionLabs.Collections.Trees.TreeQueue.ToArray() -> T[]! TunnelVisionLabs.Collections.Trees.TreeQueue.TreeQueue() -> void TunnelVisionLabs.Collections.Trees.TreeQueue.TreeQueue(int branchingFactor) -> void TunnelVisionLabs.Collections.Trees.TreeQueue.TrimExcess() -> void @@ -696,136 +664,134 @@ TunnelVisionLabs.Collections.Trees.TreeQueue.TryPeek(out T result) -> bool TunnelVisionLabs.Collections.Trees.TreeSet TunnelVisionLabs.Collections.Trees.TreeSet.Add(T item) -> bool TunnelVisionLabs.Collections.Trees.TreeSet.Clear() -> void -TunnelVisionLabs.Collections.Trees.TreeSet.Comparer.get -> System.Collections.Generic.IEqualityComparer +TunnelVisionLabs.Collections.Trees.TreeSet.Comparer.get -> System.Collections.Generic.IEqualityComparer! TunnelVisionLabs.Collections.Trees.TreeSet.Contains(T item) -> bool -TunnelVisionLabs.Collections.Trees.TreeSet.CopyTo(T[] array) -> void -TunnelVisionLabs.Collections.Trees.TreeSet.CopyTo(T[] array, int arrayIndex) -> void -TunnelVisionLabs.Collections.Trees.TreeSet.CopyTo(T[] array, int arrayIndex, int count) -> void +TunnelVisionLabs.Collections.Trees.TreeSet.CopyTo(T[]! array) -> void +TunnelVisionLabs.Collections.Trees.TreeSet.CopyTo(T[]! array, int arrayIndex) -> void +TunnelVisionLabs.Collections.Trees.TreeSet.CopyTo(T[]! array, int arrayIndex, int count) -> void TunnelVisionLabs.Collections.Trees.TreeSet.Count.get -> int TunnelVisionLabs.Collections.Trees.TreeSet.Enumerator TunnelVisionLabs.Collections.Trees.TreeSet.Enumerator.Current.get -> T TunnelVisionLabs.Collections.Trees.TreeSet.Enumerator.Dispose() -> void -TunnelVisionLabs.Collections.Trees.TreeSet.Enumerator.Enumerator() -> void TunnelVisionLabs.Collections.Trees.TreeSet.Enumerator.MoveNext() -> bool -TunnelVisionLabs.Collections.Trees.TreeSet.ExceptWith(System.Collections.Generic.IEnumerable other) -> void +TunnelVisionLabs.Collections.Trees.TreeSet.ExceptWith(System.Collections.Generic.IEnumerable! other) -> void TunnelVisionLabs.Collections.Trees.TreeSet.GetEnumerator() -> TunnelVisionLabs.Collections.Trees.TreeSet.Enumerator -TunnelVisionLabs.Collections.Trees.TreeSet.IntersectWith(System.Collections.Generic.IEnumerable other) -> void -TunnelVisionLabs.Collections.Trees.TreeSet.IsProperSubsetOf(System.Collections.Generic.IEnumerable other) -> bool -TunnelVisionLabs.Collections.Trees.TreeSet.IsProperSupersetOf(System.Collections.Generic.IEnumerable other) -> bool -TunnelVisionLabs.Collections.Trees.TreeSet.IsSubsetOf(System.Collections.Generic.IEnumerable other) -> bool -TunnelVisionLabs.Collections.Trees.TreeSet.IsSupersetOf(System.Collections.Generic.IEnumerable other) -> bool -TunnelVisionLabs.Collections.Trees.TreeSet.Overlaps(System.Collections.Generic.IEnumerable other) -> bool +TunnelVisionLabs.Collections.Trees.TreeSet.IntersectWith(System.Collections.Generic.IEnumerable! other) -> void +TunnelVisionLabs.Collections.Trees.TreeSet.IsProperSubsetOf(System.Collections.Generic.IEnumerable! other) -> bool +TunnelVisionLabs.Collections.Trees.TreeSet.IsProperSupersetOf(System.Collections.Generic.IEnumerable! other) -> bool +TunnelVisionLabs.Collections.Trees.TreeSet.IsSubsetOf(System.Collections.Generic.IEnumerable! other) -> bool +TunnelVisionLabs.Collections.Trees.TreeSet.IsSupersetOf(System.Collections.Generic.IEnumerable! other) -> bool +TunnelVisionLabs.Collections.Trees.TreeSet.Overlaps(System.Collections.Generic.IEnumerable! other) -> bool TunnelVisionLabs.Collections.Trees.TreeSet.Remove(T item) -> bool -TunnelVisionLabs.Collections.Trees.TreeSet.RemoveWhere(System.Predicate match) -> int -TunnelVisionLabs.Collections.Trees.TreeSet.SetEquals(System.Collections.Generic.IEnumerable other) -> bool -TunnelVisionLabs.Collections.Trees.TreeSet.SymmetricExceptWith(System.Collections.Generic.IEnumerable other) -> void +TunnelVisionLabs.Collections.Trees.TreeSet.RemoveWhere(System.Predicate! match) -> int +TunnelVisionLabs.Collections.Trees.TreeSet.SetEquals(System.Collections.Generic.IEnumerable! other) -> bool +TunnelVisionLabs.Collections.Trees.TreeSet.SymmetricExceptWith(System.Collections.Generic.IEnumerable! other) -> void TunnelVisionLabs.Collections.Trees.TreeSet.TreeSet() -> void -TunnelVisionLabs.Collections.Trees.TreeSet.TreeSet(System.Collections.Generic.IEnumerable collection) -> void -TunnelVisionLabs.Collections.Trees.TreeSet.TreeSet(System.Collections.Generic.IEnumerable collection, System.Collections.Generic.IEqualityComparer comparer) -> void -TunnelVisionLabs.Collections.Trees.TreeSet.TreeSet(System.Collections.Generic.IEqualityComparer comparer) -> void +TunnelVisionLabs.Collections.Trees.TreeSet.TreeSet(System.Collections.Generic.IEnumerable! collection) -> void +TunnelVisionLabs.Collections.Trees.TreeSet.TreeSet(System.Collections.Generic.IEnumerable! collection, System.Collections.Generic.IEqualityComparer? comparer) -> void +TunnelVisionLabs.Collections.Trees.TreeSet.TreeSet(System.Collections.Generic.IEqualityComparer? comparer) -> void TunnelVisionLabs.Collections.Trees.TreeSet.TreeSet(int branchingFactor) -> void -TunnelVisionLabs.Collections.Trees.TreeSet.TreeSet(int branchingFactor, System.Collections.Generic.IEnumerable collection, System.Collections.Generic.IEqualityComparer comparer) -> void -TunnelVisionLabs.Collections.Trees.TreeSet.TreeSet(int branchingFactor, System.Collections.Generic.IEqualityComparer comparer) -> void +TunnelVisionLabs.Collections.Trees.TreeSet.TreeSet(int branchingFactor, System.Collections.Generic.IEnumerable! collection, System.Collections.Generic.IEqualityComparer? comparer) -> void +TunnelVisionLabs.Collections.Trees.TreeSet.TreeSet(int branchingFactor, System.Collections.Generic.IEqualityComparer? comparer) -> void TunnelVisionLabs.Collections.Trees.TreeSet.TrimExcess() -> void TunnelVisionLabs.Collections.Trees.TreeSet.TryGetValue(T equalValue, out T actualValue) -> bool -TunnelVisionLabs.Collections.Trees.TreeSet.UnionWith(System.Collections.Generic.IEnumerable other) -> void +TunnelVisionLabs.Collections.Trees.TreeSet.UnionWith(System.Collections.Generic.IEnumerable! other) -> void TunnelVisionLabs.Collections.Trees.TreeStack TunnelVisionLabs.Collections.Trees.TreeStack.Clear() -> void TunnelVisionLabs.Collections.Trees.TreeStack.Contains(T item) -> bool -TunnelVisionLabs.Collections.Trees.TreeStack.CopyTo(T[] array, int arrayIndex) -> void +TunnelVisionLabs.Collections.Trees.TreeStack.CopyTo(T[]! array, int arrayIndex) -> void TunnelVisionLabs.Collections.Trees.TreeStack.Count.get -> int TunnelVisionLabs.Collections.Trees.TreeStack.Enumerator TunnelVisionLabs.Collections.Trees.TreeStack.Enumerator.Current.get -> T TunnelVisionLabs.Collections.Trees.TreeStack.Enumerator.Dispose() -> void -TunnelVisionLabs.Collections.Trees.TreeStack.Enumerator.Enumerator() -> void TunnelVisionLabs.Collections.Trees.TreeStack.Enumerator.MoveNext() -> bool TunnelVisionLabs.Collections.Trees.TreeStack.GetEnumerator() -> TunnelVisionLabs.Collections.Trees.TreeStack.Enumerator TunnelVisionLabs.Collections.Trees.TreeStack.Peek() -> T TunnelVisionLabs.Collections.Trees.TreeStack.Pop() -> T TunnelVisionLabs.Collections.Trees.TreeStack.Push(T item) -> void -TunnelVisionLabs.Collections.Trees.TreeStack.ToArray() -> T[] +TunnelVisionLabs.Collections.Trees.TreeStack.ToArray() -> T[]! TunnelVisionLabs.Collections.Trees.TreeStack.TreeStack() -> void TunnelVisionLabs.Collections.Trees.TreeStack.TreeStack(int branchingFactor) -> void TunnelVisionLabs.Collections.Trees.TreeStack.TrimExcess() -> void TunnelVisionLabs.Collections.Trees.TreeStack.TryPeek(out T result) -> bool TunnelVisionLabs.Collections.Trees.TreeStack.TryPop(out T result) -> bool -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Create() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Create(System.Collections.Generic.IComparer keyComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Create(System.Collections.Generic.IComparer keyComparer, System.Collections.Generic.IEqualityComparer valueComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.CreateBuilder() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Builder -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.CreateBuilder(System.Collections.Generic.IComparer keyComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Builder -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.CreateBuilder(System.Collections.Generic.IComparer keyComparer, System.Collections.Generic.IEqualityComparer valueComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Builder -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.CreateRange(System.Collections.Generic.IComparer keyComparer, System.Collections.Generic.IEnumerable> items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.CreateRange(System.Collections.Generic.IComparer keyComparer, System.Collections.Generic.IEqualityComparer valueComparer, System.Collections.Generic.IEnumerable> items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.CreateRange(System.Collections.Generic.IEnumerable> items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.ToImmutableSortedTreeDictionary(this System.Collections.Generic.IEnumerable> items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.ToImmutableSortedTreeDictionary(this System.Collections.Generic.IEnumerable> items, System.Collections.Generic.IComparer keyComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.ToImmutableSortedTreeDictionary(this System.Collections.Generic.IEnumerable> items, System.Collections.Generic.IComparer keyComparer, System.Collections.Generic.IEqualityComparer valueComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.ToImmutableSortedTreeDictionary(this System.Collections.Generic.IEnumerable source, System.Func keySelector, System.Func elementSelector) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.ToImmutableSortedTreeDictionary(this System.Collections.Generic.IEnumerable source, System.Func keySelector, System.Func elementSelector, System.Collections.Generic.IComparer keyComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.ToImmutableSortedTreeDictionary(this System.Collections.Generic.IEnumerable source, System.Func keySelector, System.Func elementSelector, System.Collections.Generic.IComparer keyComparer, System.Collections.Generic.IEqualityComparer valueComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Create() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Create(System.Collections.Generic.IComparer comparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Create(System.Collections.Generic.IComparer comparer, T item) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Create(System.Collections.Generic.IComparer comparer, params T[] items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Create(T item) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Create(params T[] items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.CreateBuilder() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Builder -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.CreateBuilder(System.Collections.Generic.IComparer comparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Builder -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.CreateRange(System.Collections.Generic.IComparer comparer, System.Collections.Generic.IEnumerable items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.CreateRange(System.Collections.Generic.IEnumerable items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.ToImmutableSortedTreeSet(this System.Collections.Generic.IEnumerable source) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.ToImmutableSortedTreeSet(this System.Collections.Generic.IEnumerable source, System.Collections.Generic.IComparer comparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Create() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Create(System.Collections.Generic.IEqualityComparer keyComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Create(System.Collections.Generic.IEqualityComparer keyComparer, System.Collections.Generic.IEqualityComparer valueComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.CreateBuilder() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Builder -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.CreateBuilder(System.Collections.Generic.IEqualityComparer keyComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Builder -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.CreateBuilder(System.Collections.Generic.IEqualityComparer keyComparer, System.Collections.Generic.IEqualityComparer valueComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Builder -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.CreateRange(System.Collections.Generic.IEnumerable> items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.CreateRange(System.Collections.Generic.IEqualityComparer keyComparer, System.Collections.Generic.IEnumerable> items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.CreateRange(System.Collections.Generic.IEqualityComparer keyComparer, System.Collections.Generic.IEqualityComparer valueComparer, System.Collections.Generic.IEnumerable> items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.ToImmutableTreeDictionary(this System.Collections.Generic.IEnumerable> items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.ToImmutableTreeDictionary(this System.Collections.Generic.IEnumerable> items, System.Collections.Generic.IEqualityComparer keyComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.ToImmutableTreeDictionary(this System.Collections.Generic.IEnumerable> items, System.Collections.Generic.IEqualityComparer keyComparer, System.Collections.Generic.IEqualityComparer valueComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.ToImmutableTreeDictionary(this System.Collections.Generic.IEnumerable source, System.Func keySelector, System.Func elementSelector) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.ToImmutableTreeDictionary(this System.Collections.Generic.IEnumerable source, System.Func keySelector, System.Func elementSelector, System.Collections.Generic.IEqualityComparer keyComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.ToImmutableTreeDictionary(this System.Collections.Generic.IEnumerable source, System.Func keySelector, System.Func elementSelector, System.Collections.Generic.IEqualityComparer keyComparer, System.Collections.Generic.IEqualityComparer valueComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.ToImmutableTreeDictionary(this System.Collections.Generic.IEnumerable source, System.Func keySelector) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.ToImmutableTreeDictionary(this System.Collections.Generic.IEnumerable source, System.Func keySelector, System.Collections.Generic.IEqualityComparer keyComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Create() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Create(T item) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Create(params T[] items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.CreateBuilder() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.CreateRange(System.Collections.Generic.IEnumerable items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.ToImmutableTreeList(this System.Collections.Generic.IEnumerable source) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeQueue.Create() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeQueue -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeQueue.Create(T item) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeQueue -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeQueue.Create(params T[] items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeQueue -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeQueue.CreateRange(System.Collections.Generic.IEnumerable items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeQueue -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Create() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Create(System.Collections.Generic.IEqualityComparer equalityComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Create(System.Collections.Generic.IEqualityComparer equalityComparer, T item) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Create(System.Collections.Generic.IEqualityComparer equalityComparer, params T[] items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Create(T item) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Create(params T[] items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.CreateBuilder() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Builder -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.CreateBuilder(System.Collections.Generic.IEqualityComparer equalityComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Builder -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.CreateRange(System.Collections.Generic.IEnumerable items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.CreateRange(System.Collections.Generic.IEqualityComparer equalityComparer, System.Collections.Generic.IEnumerable items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.ToImmutableTreeSet(this System.Collections.Generic.IEnumerable source) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.ToImmutableTreeSet(this System.Collections.Generic.IEnumerable source, System.Collections.Generic.IEqualityComparer equalityComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeStack.Create() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeStack -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeStack.Create(T item) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeStack -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeStack.Create(params T[] items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeStack -static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeStack.CreateRange(System.Collections.Generic.IEnumerable items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeStack -static TunnelVisionLabs.Collections.Trees.SortedTreeSet.CreateSetComparer() -> System.Collections.Generic.IEqualityComparer> -static TunnelVisionLabs.Collections.Trees.SortedTreeSet.CreateSetComparer(System.Collections.Generic.IEqualityComparer memberEqualityComparer) -> System.Collections.Generic.IEqualityComparer> -static TunnelVisionLabs.Collections.Trees.TreeSet.CreateSetComparer() -> System.Collections.Generic.IEqualityComparer> -static readonly TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Empty -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary -static readonly TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Empty -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet -static readonly TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Empty -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary -static readonly TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Empty -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList -static readonly TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeQueue.Empty -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeQueue -static readonly TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Empty -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet -static readonly TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeStack.Empty -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeStack +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Create() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Create(System.Collections.Generic.IComparer? keyComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Create(System.Collections.Generic.IComparer? keyComparer, System.Collections.Generic.IEqualityComparer? valueComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.CreateBuilder() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Builder! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.CreateBuilder(System.Collections.Generic.IComparer? keyComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Builder! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.CreateBuilder(System.Collections.Generic.IComparer? keyComparer, System.Collections.Generic.IEqualityComparer? valueComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Builder! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.CreateRange(System.Collections.Generic.IComparer? keyComparer, System.Collections.Generic.IEnumerable>! items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.CreateRange(System.Collections.Generic.IComparer? keyComparer, System.Collections.Generic.IEqualityComparer? valueComparer, System.Collections.Generic.IEnumerable>! items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.CreateRange(System.Collections.Generic.IEnumerable>! items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.ToImmutableSortedTreeDictionary(this System.Collections.Generic.IEnumerable>! items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.ToImmutableSortedTreeDictionary(this System.Collections.Generic.IEnumerable>! items, System.Collections.Generic.IComparer? keyComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.ToImmutableSortedTreeDictionary(this System.Collections.Generic.IEnumerable>! items, System.Collections.Generic.IComparer? keyComparer, System.Collections.Generic.IEqualityComparer? valueComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.ToImmutableSortedTreeDictionary(this System.Collections.Generic.IEnumerable! source, System.Func! keySelector, System.Func! elementSelector) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.ToImmutableSortedTreeDictionary(this System.Collections.Generic.IEnumerable! source, System.Func! keySelector, System.Func! elementSelector, System.Collections.Generic.IComparer? keyComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.ToImmutableSortedTreeDictionary(this System.Collections.Generic.IEnumerable! source, System.Func! keySelector, System.Func! elementSelector, System.Collections.Generic.IComparer? keyComparer, System.Collections.Generic.IEqualityComparer? valueComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Create() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Create(System.Collections.Generic.IComparer? comparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Create(System.Collections.Generic.IComparer? comparer, T item) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Create(System.Collections.Generic.IComparer? comparer, params T[]! items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Create(T item) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Create(params T[]! items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.CreateBuilder() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Builder! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.CreateBuilder(System.Collections.Generic.IComparer? comparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Builder! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.CreateRange(System.Collections.Generic.IComparer? comparer, System.Collections.Generic.IEnumerable! items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.CreateRange(System.Collections.Generic.IEnumerable! items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.ToImmutableSortedTreeSet(this System.Collections.Generic.IEnumerable! source) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.ToImmutableSortedTreeSet(this System.Collections.Generic.IEnumerable! source, System.Collections.Generic.IComparer? comparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Create() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Create(System.Collections.Generic.IEqualityComparer? keyComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Create(System.Collections.Generic.IEqualityComparer? keyComparer, System.Collections.Generic.IEqualityComparer? valueComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.CreateBuilder() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Builder! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.CreateBuilder(System.Collections.Generic.IEqualityComparer? keyComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Builder! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.CreateBuilder(System.Collections.Generic.IEqualityComparer? keyComparer, System.Collections.Generic.IEqualityComparer? valueComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Builder! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.CreateRange(System.Collections.Generic.IEnumerable>! items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.CreateRange(System.Collections.Generic.IEqualityComparer? keyComparer, System.Collections.Generic.IEnumerable>! items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.CreateRange(System.Collections.Generic.IEqualityComparer? keyComparer, System.Collections.Generic.IEqualityComparer? valueComparer, System.Collections.Generic.IEnumerable>! items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.ToImmutableTreeDictionary(this System.Collections.Generic.IEnumerable>! items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.ToImmutableTreeDictionary(this System.Collections.Generic.IEnumerable>! items, System.Collections.Generic.IEqualityComparer? keyComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.ToImmutableTreeDictionary(this System.Collections.Generic.IEnumerable>! items, System.Collections.Generic.IEqualityComparer? keyComparer, System.Collections.Generic.IEqualityComparer? valueComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.ToImmutableTreeDictionary(this System.Collections.Generic.IEnumerable! source, System.Func! keySelector, System.Func! elementSelector) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.ToImmutableTreeDictionary(this System.Collections.Generic.IEnumerable! source, System.Func! keySelector, System.Func! elementSelector, System.Collections.Generic.IEqualityComparer? keyComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.ToImmutableTreeDictionary(this System.Collections.Generic.IEnumerable! source, System.Func! keySelector, System.Func! elementSelector, System.Collections.Generic.IEqualityComparer? keyComparer, System.Collections.Generic.IEqualityComparer? valueComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.ToImmutableTreeDictionary(this System.Collections.Generic.IEnumerable! source, System.Func! keySelector) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.ToImmutableTreeDictionary(this System.Collections.Generic.IEnumerable! source, System.Func! keySelector, System.Collections.Generic.IEqualityComparer? keyComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Create() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Create(T item) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Create(params T[]! items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.CreateBuilder() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Builder! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.CreateRange(System.Collections.Generic.IEnumerable! items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.ToImmutableTreeList(this System.Collections.Generic.IEnumerable! source) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeQueue.Create() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeQueue! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeQueue.Create(T item) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeQueue! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeQueue.Create(params T[]! items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeQueue! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeQueue.CreateRange(System.Collections.Generic.IEnumerable! items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeQueue! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Create() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Create(System.Collections.Generic.IEqualityComparer? equalityComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Create(System.Collections.Generic.IEqualityComparer? equalityComparer, T item) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Create(System.Collections.Generic.IEqualityComparer? equalityComparer, params T[]! items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Create(T item) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Create(params T[]! items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.CreateBuilder() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Builder! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.CreateBuilder(System.Collections.Generic.IEqualityComparer? equalityComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Builder! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.CreateRange(System.Collections.Generic.IEnumerable! items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.CreateRange(System.Collections.Generic.IEqualityComparer? equalityComparer, System.Collections.Generic.IEnumerable! items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.ToImmutableTreeSet(this System.Collections.Generic.IEnumerable! source) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.ToImmutableTreeSet(this System.Collections.Generic.IEnumerable! source, System.Collections.Generic.IEqualityComparer? equalityComparer) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeStack.Create() -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeStack! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeStack.Create(T item) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeStack! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeStack.Create(params T[]! items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeStack! +static TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeStack.CreateRange(System.Collections.Generic.IEnumerable! items) -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeStack! +static TunnelVisionLabs.Collections.Trees.SortedTreeSet.CreateSetComparer() -> System.Collections.Generic.IEqualityComparer?>! +static TunnelVisionLabs.Collections.Trees.SortedTreeSet.CreateSetComparer(System.Collections.Generic.IEqualityComparer? memberEqualityComparer) -> System.Collections.Generic.IEqualityComparer?>! +static TunnelVisionLabs.Collections.Trees.TreeSet.CreateSetComparer() -> System.Collections.Generic.IEqualityComparer?>! +static readonly TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary.Empty -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeDictionary! +static readonly TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet.Empty -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableSortedTreeSet! +static readonly TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary.Empty -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeDictionary! +static readonly TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList.Empty -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeList! +static readonly TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeQueue.Empty -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeQueue! +static readonly TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet.Empty -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeSet! +static readonly TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeStack.Empty -> TunnelVisionLabs.Collections.Trees.Immutable.ImmutableTreeStack! diff --git a/TunnelVisionLabs.Collections.Trees/SortedTreeDictionary`2+Enumerator.cs b/TunnelVisionLabs.Collections.Trees/SortedTreeDictionary`2+Enumerator.cs index 48fff2d..6b6cd08 100644 --- a/TunnelVisionLabs.Collections.Trees/SortedTreeDictionary`2+Enumerator.cs +++ b/TunnelVisionLabs.Collections.Trees/SortedTreeDictionary`2+Enumerator.cs @@ -46,7 +46,7 @@ internal enum ReturnType object IDictionaryEnumerator.Key => Current.Key; - object IDictionaryEnumerator.Value => Current.Value; + object? IDictionaryEnumerator.Value => Current.Value; public void Dispose() => _enumerator.Dispose(); diff --git a/TunnelVisionLabs.Collections.Trees/SortedTreeDictionary`2+ValueCollection+Enumerator.cs b/TunnelVisionLabs.Collections.Trees/SortedTreeDictionary`2+ValueCollection+Enumerator.cs index e113a1c..e2f3aef 100644 --- a/TunnelVisionLabs.Collections.Trees/SortedTreeDictionary`2+ValueCollection+Enumerator.cs +++ b/TunnelVisionLabs.Collections.Trees/SortedTreeDictionary`2+ValueCollection+Enumerator.cs @@ -21,7 +21,7 @@ internal Enumerator(SortedTreeDictionary.Enumerator enumerator) public TValue Current => _enumerator.Current.Value; - object IEnumerator.Current => Current; + object? IEnumerator.Current => Current; public void Dispose() => _enumerator.Dispose(); diff --git a/TunnelVisionLabs.Collections.Trees/SortedTreeDictionary`2+ValueCollection.cs b/TunnelVisionLabs.Collections.Trees/SortedTreeDictionary`2+ValueCollection.cs index c0f6d7b..da89bf5 100644 --- a/TunnelVisionLabs.Collections.Trees/SortedTreeDictionary`2+ValueCollection.cs +++ b/TunnelVisionLabs.Collections.Trees/SortedTreeDictionary`2+ValueCollection.cs @@ -72,7 +72,7 @@ void ICollection.CopyTo(Array array, int index) { CopyTo(values, index); } - else if (array is object[] objects) + else if (array is object?[] objects) { try { diff --git a/TunnelVisionLabs.Collections.Trees/SortedTreeDictionary`2.cs b/TunnelVisionLabs.Collections.Trees/SortedTreeDictionary`2.cs index 4ea1b3a..d410fba 100644 --- a/TunnelVisionLabs.Collections.Trees/SortedTreeDictionary`2.cs +++ b/TunnelVisionLabs.Collections.Trees/SortedTreeDictionary`2.cs @@ -6,11 +6,12 @@ namespace TunnelVisionLabs.Collections.Trees using System; using System.Collections; using System.Collections.Generic; - using System.Diagnostics; + using System.Diagnostics.CodeAnalysis; using System.Linq; using IDictionary = System.Collections.IDictionary; public partial class SortedTreeDictionary : IDictionary, IReadOnlyDictionary, IDictionary + where TKey : notnull { private readonly IComparer _comparer; private readonly SortedTreeSet> _treeSet; @@ -25,13 +26,13 @@ public SortedTreeDictionary(IEnumerable> collection) { } - public SortedTreeDictionary(IComparer comparer) + public SortedTreeDictionary(IComparer? comparer) { _comparer = comparer ?? Comparer.Default; _treeSet = new SortedTreeSet>(new KeyOfPairComparer(_comparer)); } - public SortedTreeDictionary(IEnumerable> collection, IComparer comparer) + public SortedTreeDictionary(IEnumerable> collection, IComparer? comparer) : this(comparer) { if (collection == null) @@ -48,13 +49,13 @@ public SortedTreeDictionary(int branchingFactor) { } - public SortedTreeDictionary(int branchingFactor, IComparer comparer) + public SortedTreeDictionary(int branchingFactor, IComparer? comparer) { _comparer = comparer ?? Comparer.Default; _treeSet = new SortedTreeSet>(branchingFactor, new KeyOfPairComparer(_comparer)); } - public SortedTreeDictionary(int branchingFactor, IEnumerable> collection, IComparer comparer) + public SortedTreeDictionary(int branchingFactor, IEnumerable> collection, IComparer? comparer) : this(branchingFactor, comparer) { if (collection == null) @@ -100,7 +101,7 @@ public TValue this[TKey key] { get { - if (!_treeSet.TryGetValue(new KeyValuePair(key, default), out KeyValuePair value)) + if (!_treeSet.TryGetValue(new KeyValuePair(key, default!), out KeyValuePair value)) throw new KeyNotFoundException(); return value.Value; @@ -108,12 +109,12 @@ public TValue this[TKey key] set { - _treeSet.Remove(new KeyValuePair(key, default)); + _treeSet.Remove(new KeyValuePair(key, default!)); _treeSet.Add(new KeyValuePair(key, value)); } } - object IDictionary.this[object key] + object? IDictionary.this[object key] { get { @@ -140,7 +141,7 @@ object IDictionary.this[object key] var typedKey = (TKey)key; try { - this[typedKey] = (TValue)value; + this[typedKey] = (TValue)value!; } catch (InvalidCastException) { @@ -154,17 +155,17 @@ object IDictionary.this[object key] } } - public bool ContainsKey(TKey key) => _treeSet.Contains(new KeyValuePair(key, default)); + public bool ContainsKey(TKey key) => _treeSet.Contains(new KeyValuePair(key, default!)); - public int IndexOfKey(TKey key) => _treeSet.IndexOf(new KeyValuePair(key, default)); + public int IndexOfKey(TKey key) => _treeSet.IndexOf(new KeyValuePair(key, default!)); public bool ContainsValue(TValue value) => _treeSet.Any(pair => EqualityComparer.Default.Equals(pair.Value, value)); public int IndexOfValue(TValue value) => _treeSet.FindIndex(pair => EqualityComparer.Default.Equals(pair.Value, value)); - public bool TryGetValue(TKey key, out TValue value) + public bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value) { - if (!_treeSet.TryGetValue(new KeyValuePair(key, default), out KeyValuePair pair)) + if (!_treeSet.TryGetValue(new KeyValuePair(key, default!), out KeyValuePair pair)) { value = default; return false; @@ -186,7 +187,7 @@ public void Add(TKey key, TValue value) public void Clear() => _treeSet.Clear(); - public bool Remove(TKey key) => _treeSet.Remove(new KeyValuePair(key, default)); + public bool Remove(TKey key) => _treeSet.Remove(new KeyValuePair(key, default!)); void ICollection>.Add(KeyValuePair item) => Add(item.Key, item.Value); @@ -213,7 +214,7 @@ bool ICollection>.Remove(KeyValuePair i return true; } - void IDictionary.Add(object key, object value) + void IDictionary.Add(object key, object? value) { if (key == null) throw new ArgumentNullException(nameof(key)); @@ -225,7 +226,7 @@ void IDictionary.Add(object key, object value) var typedKey = (TKey)key; try { - Add(typedKey, (TValue)value); + Add(typedKey, (TValue)value!); } catch (InvalidCastException) { diff --git a/TunnelVisionLabs.Collections.Trees/SortedTreeList`1+Enumerator.cs b/TunnelVisionLabs.Collections.Trees/SortedTreeList`1+Enumerator.cs index 40bac1f..91055e2 100644 --- a/TunnelVisionLabs.Collections.Trees/SortedTreeList`1+Enumerator.cs +++ b/TunnelVisionLabs.Collections.Trees/SortedTreeList`1+Enumerator.cs @@ -20,7 +20,7 @@ internal Enumerator(TreeList.Enumerator enumerator) public T Current => _enumerator.Current; - object IEnumerator.Current => Current; + object? IEnumerator.Current => Current; public void Dispose() => ((IDisposable)_enumerator).Dispose(); diff --git a/TunnelVisionLabs.Collections.Trees/SortedTreeList`1.cs b/TunnelVisionLabs.Collections.Trees/SortedTreeList`1.cs index b0d5fd6..0b69452 100644 --- a/TunnelVisionLabs.Collections.Trees/SortedTreeList`1.cs +++ b/TunnelVisionLabs.Collections.Trees/SortedTreeList`1.cs @@ -7,6 +7,7 @@ namespace TunnelVisionLabs.Collections.Trees using System.Collections; using System.Collections.Generic; using System.Diagnostics; + using System.Diagnostics.CodeAnalysis; public partial class SortedTreeList : IList, IReadOnlyList, IList { @@ -23,13 +24,13 @@ public SortedTreeList(IEnumerable collection) { } - public SortedTreeList(IComparer comparer) + public SortedTreeList(IComparer? comparer) { _comparer = comparer ?? Comparer.Default; _treeList = new TreeList(); } - public SortedTreeList(IEnumerable collection, IComparer comparer) + public SortedTreeList(IEnumerable collection, IComparer? comparer) : this(comparer) { AddRange(collection); @@ -40,13 +41,13 @@ public SortedTreeList(int branchingFactor) { } - public SortedTreeList(int branchingFactor, IComparer comparer) + public SortedTreeList(int branchingFactor, IComparer? comparer) { _comparer = comparer ?? Comparer.Default; _treeList = new TreeList(branchingFactor); } - public SortedTreeList(int branchingFactor, IEnumerable collection, IComparer comparer) + public SortedTreeList(int branchingFactor, IEnumerable collection, IComparer? comparer) : this(branchingFactor, comparer) { AddRange(collection); @@ -77,7 +78,7 @@ T IList.this[int index] set => throw new NotSupportedException(); } - object IList.this[int index] + object? IList.this[int index] { get => this[index]; set => throw new NotSupportedException(); @@ -153,6 +154,7 @@ public void AddRange(IEnumerable collection) public bool Exists(Predicate match) => _treeList.Exists(match); + [return: MaybeNull] public T Find(Predicate match) => _treeList.Find(match); public SortedTreeList FindAll(Predicate match) => new SortedTreeList(_treeList.FindAll(match), _comparer); @@ -163,6 +165,7 @@ public void AddRange(IEnumerable collection) public int FindIndex(int startIndex, int count, Predicate match) => _treeList.FindIndex(startIndex, count, match); + [return: MaybeNull] public T FindLast(Predicate match) => _treeList.FindLast(match); public int FindLastIndex(Predicate match) => _treeList.FindLastIndex(match); @@ -205,29 +208,30 @@ public int LastIndexOf(T item, int index, int count) IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); - int IList.Add(object value) + int IList.Add(object? value) { if (value == null && default(T) != null) throw new ArgumentNullException(nameof(value)); try { - Add((T)value); + Add((T)value!); } catch (InvalidCastException) { + Debug.Assert(value is object, $"Assertion failed: {nameof(value)} is object"); throw new ArgumentException(string.Format("The value \"{0}\" isn't of type \"{1}\" and can't be used in this generic collection.", value.GetType(), typeof(T)), nameof(value)); } return Count - 1; } - bool IList.Contains(object value) + bool IList.Contains(object? value) { if (value == null) { if (default(T) == null) - return Contains(default); + return Contains(default!); } else if (value is T) { @@ -237,12 +241,12 @@ bool IList.Contains(object value) return false; } - int IList.IndexOf(object value) + int IList.IndexOf(object? value) { if (value == null) { if (default(T) == null) - return IndexOf(default); + return IndexOf(default!); } else if (value is T) { @@ -257,12 +261,12 @@ void IList.Insert(int index, T item) throw new NotSupportedException(); } - void IList.Insert(int index, object value) + void IList.Insert(int index, object? value) { throw new NotSupportedException(); } - void IList.Remove(object value) + void IList.Remove(object? value) { int index = ((IList)this).IndexOf(value); if (index >= 0) @@ -299,7 +303,7 @@ public CoercingComparer(IComparer underlyingComparer, int coerceResult) public bool FoundMatch => _foundMatch; - public int Compare(T x, T y) + public int Compare([AllowNull] T x, [AllowNull] T y) { int result = _underlyingComparer.Compare(x, y); if (result != 0) diff --git a/TunnelVisionLabs.Collections.Trees/SortedTreeSet`1+Enumerator.cs b/TunnelVisionLabs.Collections.Trees/SortedTreeSet`1+Enumerator.cs index 57d31dc..c8783bd 100644 --- a/TunnelVisionLabs.Collections.Trees/SortedTreeSet`1+Enumerator.cs +++ b/TunnelVisionLabs.Collections.Trees/SortedTreeSet`1+Enumerator.cs @@ -19,7 +19,7 @@ internal Enumerator(SortedTreeList.Enumerator enumerator) public T Current => _enumerator.Current; - object IEnumerator.Current => Current; + object? IEnumerator.Current => Current; public void Dispose() => _enumerator.Dispose(); diff --git a/TunnelVisionLabs.Collections.Trees/SortedTreeSet`1.cs b/TunnelVisionLabs.Collections.Trees/SortedTreeSet`1.cs index e03676f..1e72865 100644 --- a/TunnelVisionLabs.Collections.Trees/SortedTreeSet`1.cs +++ b/TunnelVisionLabs.Collections.Trees/SortedTreeSet`1.cs @@ -7,6 +7,7 @@ namespace TunnelVisionLabs.Collections.Trees using System.Collections; using System.Collections.Generic; using System.Diagnostics; + using System.Diagnostics.CodeAnalysis; using System.Linq; public partial class SortedTreeSet : ISet, IReadOnlyCollection, ICollection @@ -24,12 +25,12 @@ public SortedTreeSet(IEnumerable collection) UnionWith(collection); } - public SortedTreeSet(IComparer comparer) + public SortedTreeSet(IComparer? comparer) { _sortedList = new SortedTreeList(comparer); } - public SortedTreeSet(IEnumerable collection, IComparer comparer) + public SortedTreeSet(IEnumerable collection, IComparer? comparer) { _sortedList = new SortedTreeList(comparer); UnionWith(collection); @@ -40,12 +41,12 @@ public SortedTreeSet(int branchingFactor) _sortedList = new SortedTreeList(branchingFactor); } - public SortedTreeSet(int branchingFactor, IComparer comparer) + public SortedTreeSet(int branchingFactor, IComparer? comparer) { _sortedList = new SortedTreeList(branchingFactor, comparer); } - public SortedTreeSet(int branchingFactor, IEnumerable collection, IComparer comparer) + public SortedTreeSet(int branchingFactor, IEnumerable collection, IComparer? comparer) { _sortedList = new SortedTreeList(branchingFactor, comparer); UnionWith(collection); @@ -55,8 +56,10 @@ public SortedTreeSet(int branchingFactor, IEnumerable collection, IComparer _sortedList.Count; + [MaybeNull] public T Max => _sortedList.Count == 0 ? default : _sortedList[Count - 1]; + [MaybeNull] public T Min => _sortedList.Count == 0 ? default : _sortedList[0]; bool ICollection.IsReadOnly => false; @@ -65,12 +68,12 @@ public SortedTreeSet(int branchingFactor, IEnumerable collection, IComparer this; - public static IEqualityComparer> CreateSetComparer() + public static IEqualityComparer?> CreateSetComparer() { return SortedTreeSetEqualityComparer.Default; } - public static IEqualityComparer> CreateSetComparer(IEqualityComparer memberEqualityComparer) + public static IEqualityComparer?> CreateSetComparer(IEqualityComparer? memberEqualityComparer) { if (memberEqualityComparer == null || memberEqualityComparer == EqualityComparer.Default) return CreateSetComparer(); @@ -391,7 +394,7 @@ public void UnionWith(IEnumerable other) public void TrimExcess() => _sortedList.TrimExcess(); - public bool TryGetValue(T equalValue, out T actualValue) + public bool TryGetValue(T equalValue, [MaybeNullWhen(false)] out T actualValue) { int index = _sortedList.BinarySearch(equalValue); if (index < 0) @@ -423,9 +426,9 @@ internal void Validate(ValidationRules validationRules) } } - private class SortedTreeSetEqualityComparer : IEqualityComparer> + private class SortedTreeSetEqualityComparer : IEqualityComparer?> { - public static readonly IEqualityComparer> Default = new SortedTreeSetEqualityComparer(); + public static readonly IEqualityComparer?> Default = new SortedTreeSetEqualityComparer(); private readonly IComparer _comparer = Comparer.Default; private readonly IEqualityComparer _equalityComparer; @@ -435,12 +438,12 @@ private SortedTreeSetEqualityComparer() { } - public SortedTreeSetEqualityComparer(IEqualityComparer memberEqualityComparer) + public SortedTreeSetEqualityComparer(IEqualityComparer? memberEqualityComparer) { _equalityComparer = memberEqualityComparer ?? EqualityComparer.Default; } - public override bool Equals(object obj) + public override bool Equals(object? obj) { if (!(obj is SortedTreeSetEqualityComparer comparer)) return false; @@ -453,7 +456,7 @@ public override int GetHashCode() return _comparer.GetHashCode() ^ _equalityComparer.GetHashCode(); } - public bool Equals(SortedTreeSet x, SortedTreeSet y) + public bool Equals(SortedTreeSet? x, SortedTreeSet? y) { if (x is null) { @@ -491,7 +494,7 @@ public bool Equals(SortedTreeSet x, SortedTreeSet y) return true; } - public int GetHashCode(SortedTreeSet obj) + public int GetHashCode(SortedTreeSet? obj) { if (obj == null) return 0; diff --git a/TunnelVisionLabs.Collections.Trees/TreeDictionary`2+Enumerator.cs b/TunnelVisionLabs.Collections.Trees/TreeDictionary`2+Enumerator.cs index 62c1526..71148f4 100644 --- a/TunnelVisionLabs.Collections.Trees/TreeDictionary`2+Enumerator.cs +++ b/TunnelVisionLabs.Collections.Trees/TreeDictionary`2+Enumerator.cs @@ -46,7 +46,7 @@ internal enum ReturnType object IDictionaryEnumerator.Key => Current.Key; - object IDictionaryEnumerator.Value => Current.Value; + object? IDictionaryEnumerator.Value => Current.Value; public void Dispose() => _enumerator.Dispose(); diff --git a/TunnelVisionLabs.Collections.Trees/TreeDictionary`2+ValueCollection+Enumerator.cs b/TunnelVisionLabs.Collections.Trees/TreeDictionary`2+ValueCollection+Enumerator.cs index a204c95..29ebcfb 100644 --- a/TunnelVisionLabs.Collections.Trees/TreeDictionary`2+ValueCollection+Enumerator.cs +++ b/TunnelVisionLabs.Collections.Trees/TreeDictionary`2+ValueCollection+Enumerator.cs @@ -21,7 +21,7 @@ internal Enumerator(TreeDictionary.Enumerator enumerator) public TValue Current => _enumerator.Current.Value; - object IEnumerator.Current => Current; + object? IEnumerator.Current => Current; public void Dispose() => _enumerator.Dispose(); diff --git a/TunnelVisionLabs.Collections.Trees/TreeDictionary`2+ValueCollection.cs b/TunnelVisionLabs.Collections.Trees/TreeDictionary`2+ValueCollection.cs index 4d41f5b..37baee1 100644 --- a/TunnelVisionLabs.Collections.Trees/TreeDictionary`2+ValueCollection.cs +++ b/TunnelVisionLabs.Collections.Trees/TreeDictionary`2+ValueCollection.cs @@ -72,7 +72,7 @@ void ICollection.CopyTo(Array array, int index) { CopyTo(values, index); } - else if (array is object[] objects) + else if (array is object?[] objects) { try { diff --git a/TunnelVisionLabs.Collections.Trees/TreeDictionary`2.cs b/TunnelVisionLabs.Collections.Trees/TreeDictionary`2.cs index b07b6d9..2d0bb94 100644 --- a/TunnelVisionLabs.Collections.Trees/TreeDictionary`2.cs +++ b/TunnelVisionLabs.Collections.Trees/TreeDictionary`2.cs @@ -6,10 +6,12 @@ namespace TunnelVisionLabs.Collections.Trees using System; using System.Collections; using System.Collections.Generic; + using System.Diagnostics.CodeAnalysis; using System.Linq; using IDictionary = System.Collections.IDictionary; public partial class TreeDictionary : IDictionary, IReadOnlyDictionary, IDictionary + where TKey : notnull { private readonly IEqualityComparer _comparer; private readonly TreeSet> _treeSet; @@ -24,13 +26,13 @@ public TreeDictionary(IEnumerable> collection) { } - public TreeDictionary(IEqualityComparer comparer) + public TreeDictionary(IEqualityComparer? comparer) { _comparer = comparer ?? EqualityComparer.Default; _treeSet = new TreeSet>(new KeyOfPairEqualityComparer(_comparer)); } - public TreeDictionary(IEnumerable> collection, IEqualityComparer comparer) + public TreeDictionary(IEnumerable> collection, IEqualityComparer? comparer) : this(comparer) { if (collection == null) @@ -47,13 +49,13 @@ public TreeDictionary(int branchingFactor) { } - public TreeDictionary(int branchingFactor, IEqualityComparer comparer) + public TreeDictionary(int branchingFactor, IEqualityComparer? comparer) { _comparer = comparer ?? EqualityComparer.Default; _treeSet = new TreeSet>(branchingFactor, new KeyOfPairEqualityComparer(_comparer)); } - public TreeDictionary(int branchingFactor, IEnumerable> collection, IEqualityComparer comparer) + public TreeDictionary(int branchingFactor, IEnumerable> collection, IEqualityComparer? comparer) : this(branchingFactor, comparer) { if (collection == null) @@ -99,7 +101,7 @@ public TValue this[TKey key] { get { - if (!_treeSet.TryGetValue(new KeyValuePair(key, default), out KeyValuePair value)) + if (!_treeSet.TryGetValue(new KeyValuePair(key, default!), out KeyValuePair value)) throw new KeyNotFoundException(); return value.Value; @@ -107,12 +109,12 @@ public TValue this[TKey key] set { - _treeSet.Remove(new KeyValuePair(key, default)); + _treeSet.Remove(new KeyValuePair(key, default!)); _treeSet.Add(new KeyValuePair(key, value)); } } - object IDictionary.this[object key] + object? IDictionary.this[object key] { get { @@ -139,7 +141,7 @@ object IDictionary.this[object key] var typedKey = (TKey)key; try { - this[typedKey] = (TValue)value; + this[typedKey] = (TValue)value!; } catch (InvalidCastException) { @@ -153,13 +155,13 @@ object IDictionary.this[object key] } } - public bool ContainsKey(TKey key) => _treeSet.Contains(new KeyValuePair(key, default)); + public bool ContainsKey(TKey key) => _treeSet.Contains(new KeyValuePair(key, default!)); public bool ContainsValue(TValue value) => _treeSet.Any(pair => EqualityComparer.Default.Equals(pair.Value, value)); - public bool TryGetValue(TKey key, out TValue value) + public bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value) { - if (!_treeSet.TryGetValue(new KeyValuePair(key, default), out KeyValuePair pair)) + if (!_treeSet.TryGetValue(new KeyValuePair(key, default!), out KeyValuePair pair)) { value = default; return false; @@ -181,7 +183,7 @@ public void Add(TKey key, TValue value) public void Clear() => _treeSet.Clear(); - public bool Remove(TKey key) => _treeSet.Remove(new KeyValuePair(key, default)); + public bool Remove(TKey key) => _treeSet.Remove(new KeyValuePair(key, default!)); void ICollection>.Add(KeyValuePair item) => Add(item.Key, item.Value); @@ -208,7 +210,7 @@ bool ICollection>.Remove(KeyValuePair i return true; } - void IDictionary.Add(object key, object value) + void IDictionary.Add(object key, object? value) { if (key == null) throw new ArgumentNullException(nameof(key)); @@ -220,7 +222,7 @@ void IDictionary.Add(object key, object value) var typedKey = (TKey)key; try { - Add(typedKey, (TValue)value); + Add(typedKey, (TValue)value!); } catch (InvalidCastException) { diff --git a/TunnelVisionLabs.Collections.Trees/TreeList`1+Enumerator.cs b/TunnelVisionLabs.Collections.Trees/TreeList`1+Enumerator.cs index 0e2eb19..1666e03 100644 --- a/TunnelVisionLabs.Collections.Trees/TreeList`1+Enumerator.cs +++ b/TunnelVisionLabs.Collections.Trees/TreeList`1+Enumerator.cs @@ -16,7 +16,7 @@ public struct Enumerator : IEnumerator private readonly int _version; private int _index; - private LeafNode _leafNode; + private LeafNode? _leafNode; private int _leafIndex; private T _current; @@ -33,12 +33,12 @@ internal Enumerator(TreeList list, TreeSpan span) _index = -1; _leafNode = null; _leafIndex = -1; - _current = default; + _current = default!; } public T Current => _current; - object IEnumerator.Current => Current; + object? IEnumerator.Current => Current; public void Dispose() { @@ -70,7 +70,7 @@ public bool MoveNext() _index = _span.Start - 1; _leafIndex--; } - else if (_leafIndex == _leafNode.Count - 1) + else if (_leafIndex == _leafNode!.Count - 1) { // Need to move to the next leaf _leafNode = _leafNode.Next; @@ -85,7 +85,7 @@ public bool MoveNext() } _leafIndex++; - _current = _leafNode[_leafIndex]; + _current = _leafNode![_leafIndex]; return true; } @@ -99,7 +99,7 @@ internal void InternalReset() _leafNode = null; _index = -1; _leafIndex = -1; - _current = default; + _current = default!; } } } diff --git a/TunnelVisionLabs.Collections.Trees/TreeList`1+IndexNode.cs b/TunnelVisionLabs.Collections.Trees/TreeList`1+IndexNode.cs index 2abbb35..f208218 100644 --- a/TunnelVisionLabs.Collections.Trees/TreeList`1+IndexNode.cs +++ b/TunnelVisionLabs.Collections.Trees/TreeList`1+IndexNode.cs @@ -13,7 +13,7 @@ private sealed class IndexNode : Node { private readonly int[] _offsets; private readonly Node[] _nodes; - private IndexNode _next; + private IndexNode? _next; private int _nodeCount; private int _count; @@ -35,11 +35,11 @@ internal IndexNode(int branchingFactor, Node child1, Node child2) _count = child1.Count + child2.Count; } - internal IndexNode(int branchingFactor, Node firstChild, Node lastChild, out IndexNode lastNode) + internal IndexNode(int branchingFactor, Node firstChild, Node lastChild, out IndexNode? lastNode) : this(branchingFactor) { lastNode = null; - for (Node current = firstChild; current != null; current = current == lastChild ? null : current.NextNode) + for (Node? current = firstChild; current != null; current = current == lastChild ? null : current.NextNode) { if (_nodeCount == _nodes.Length) { @@ -59,13 +59,21 @@ internal IndexNode(int branchingFactor, Node firstChild, Node lastChild, out Ind internal override int Count => _count; - internal override LeafNode FirstLeaf => _nodes[0].FirstLeaf; + internal override LeafNode FirstLeaf + { + get + { + LeafNode? firstLeaf = _nodes[0].FirstLeaf; + Debug.Assert(firstLeaf is object, $"Assertion failed: {nameof(firstLeaf)} is object"); + return firstLeaf; + } + } - internal override Node NextNode => Next; + internal override Node? NextNode => Next; internal override Node FirstChild => _nodes[0]; - internal IndexNode Next => _next; + internal IndexNode? Next => _next; internal override T this[int index] { @@ -138,10 +146,10 @@ internal override int LastIndexOf(T item, TreeSpan span) return -1; } - internal override Node Insert(int branchingFactor, bool isAppend, int index, T item) + internal override Node? Insert(int branchingFactor, bool isAppend, int index, T item) { int pageIndex = FindLowerBound(_offsets, _nodeCount, index); - Node splitChild = _nodes[pageIndex].Insert(branchingFactor, isAppend, index - _offsets[pageIndex], item); + Node? splitChild = _nodes[pageIndex].Insert(branchingFactor, isAppend, index - _offsets[pageIndex], item); if (splitChild == null) { for (int i = pageIndex + 1; i < _nodeCount; i++) @@ -158,11 +166,11 @@ internal override Node Insert(int branchingFactor, bool isAppend, int index, T i return InsertIndex(branchingFactor, isAppend, pageIndex + 1, splitChild); } - internal override Node InsertRange(int branchingFactor, bool isAppend, int index, IEnumerable collection) + internal override Node? InsertRange(int branchingFactor, bool isAppend, int index, IEnumerable collection) { int pageIndex = FindLowerBound(_offsets, _nodeCount, index); int previousCount = _nodes[pageIndex].Count; - Node lastImpactedChild = _nodes[pageIndex].InsertRange(branchingFactor, isAppend, index - _offsets[pageIndex], collection); + Node? lastImpactedChild = _nodes[pageIndex].InsertRange(branchingFactor, isAppend, index - _offsets[pageIndex], collection); if (lastImpactedChild == null) { int insertionCount = _nodes[pageIndex].Count - previousCount; @@ -180,13 +188,13 @@ internal override Node InsertRange(int branchingFactor, bool isAppend, int index pageIndex++; IndexNode insertionNode = this; - Node lastIndexNode = null; - for (Node item = _nodes[pageIndex - 1].NextNode; true; item = item.NextNode) + Node? lastIndexNode = null; + for (Node? item = _nodes[pageIndex - 1].NextNode; true; item = item.NextNode) { Debug.Assert(item != null, "Assertion failed: item != null"); Debug.Assert(pageIndex >= 0 && pageIndex <= insertionNode._nodes.Length, "Assertion failed: pageIndex >= 0 && pageIndex <= insertionNode._nodes.Length"); - IndexNode newLastIndex = insertionNode.InsertIndex(branchingFactor, isAppend, pageIndex, item); + IndexNode? newLastIndex = insertionNode.InsertIndex(branchingFactor, isAppend, pageIndex, item); if (newLastIndex != null) { // this insertion resulted in a split, so at minimum 'pageIndex' must be updated @@ -259,7 +267,7 @@ internal override bool RemoveLast() Debug.Assert(removedChild, $"Assertion failed: removedChild"); _nodeCount--; _offsets[_nodeCount] = 0; - _nodes[_nodeCount] = null; + _nodes[_nodeCount] = null!; _count--; return false; } @@ -281,8 +289,8 @@ internal override bool RemoveAt(int index) // _next cannot be null if (pageIndex == _nodeCount - 1), because there is no way we needed to rebalance // the children nodes for that case. This method would have already returned above. - Node expectedNext = pageIndex == _nodeCount - 1 ? _next._nodes[0] : _nodes[pageIndex + 1]; - Node nextChild = _nodes[pageIndex].NextNode; + Node expectedNext = pageIndex == _nodeCount - 1 ? _next!._nodes[0] : _nodes[pageIndex + 1]; + Node? nextChild = _nodes[pageIndex].NextNode; bool removedChild = nextChild != expectedNext; if (!removedChild) { @@ -297,24 +305,28 @@ internal override bool RemoveAt(int index) _count = _offsets[_nodeCount - 1] + _nodes[_nodeCount - 1].Count; - bool affectedNextPage = pageIndex == _nodeCount - 1 && _next != null; - if (affectedNextPage) + if (pageIndex == _nodeCount - 1 && _next != null) { + // The next page was affected for (int i = 1; i < _next._nodeCount; i++) { _next._offsets[i] = _next._offsets[i - 1] + _next._nodes[i - 1].Count; } _next._count = _next._offsets[_next._nodeCount - 1] + _next._nodes[_next._nodeCount - 1].Count; + return true; + } + else + { + return false; } - - return affectedNextPage; } else { bool removedFromNextPage = pageIndex == _nodeCount - 1; if (removedFromNextPage) { + Debug.Assert(_next is object, $"Per the explanation above, {nameof(_next)} cannot be null when {nameof(removedFromNextPage)} is true."); if (_next._nodeCount == 1) { // Removed the only child of the next page @@ -330,7 +342,7 @@ internal override bool RemoveAt(int index) _next._nodes[0] = _nodes[_nodeCount - 1]; _count = _offsets[_nodeCount - 1]; _offsets[_nodeCount - 1] = 0; - _nodes[_nodeCount - 1] = null; + _nodes[_nodeCount - 1] = null!; _nodeCount--; for (int i = 1; i < _next._nodeCount; i++) { @@ -348,7 +360,7 @@ internal override bool RemoveAt(int index) } _offsets[_nodeCount - 1] = 0; - _nodes[_nodeCount - 1] = default; + _nodes[_nodeCount - 1] = null!; _nodeCount--; _count = _offsets[_nodeCount - 1] + _nodes[_nodeCount - 1].Count; } @@ -555,7 +567,7 @@ internal override int BinarySearch(TreeSpan span, T item, IComparer comparer) int page = lowPage + ((highPage - lowPage + 1) >> 1); Debug.Assert(page > firstPage, $"Assertion failed: {nameof(page)} > {nameof(firstPage)}"); - T value = _nodes[page].FirstLeaf[0]; + T value = _nodes[page].FirstLeaf![0]; int c; try @@ -596,11 +608,11 @@ internal override int BinarySearch(TreeSpan span, T item, IComparer comparer) } } - internal override TreeList.Node ConvertAll(Func converter, TreeList.Node convertedNextNode) + internal override TreeList.Node ConvertAll(Func converter, TreeList.Node? convertedNextNode) { var result = new TreeList.IndexNode(_nodes.Length); - TreeList.Node convertedNextChild = convertedNextNode?.FirstChild; + TreeList.Node? convertedNextChild = convertedNextNode?.FirstChild; for (int i = _nodeCount - 1; i >= 0; i--) { convertedNextChild = _nodes[i].ConvertAll(converter, convertedNextChild); @@ -608,7 +620,7 @@ internal override TreeList.Node ConvertAll(Func co } Array.Copy(_offsets, result._offsets, _nodeCount); - result._next = (TreeList.IndexNode)convertedNextNode; + result._next = (TreeList.IndexNode?)convertedNextNode; result._count = _count; result._nodeCount = _nodeCount; return result; @@ -620,14 +632,16 @@ internal override bool TrimExcess() return false; // Simply rebuild this level by walking child nodes - IndexNode first = this; + IndexNode? first = this; int firstOffset = 0; _nodeCount = 0; _count = 0; - for (Node child = FirstChild; child != null; child = child.NextNode) + for (Node? child = FirstChild; child != null; child = child.NextNode) { if (firstOffset == first._nodes.Length) { + Debug.Assert(first.Next is object, "'child.NextNode' was not null, but it pointed to a node which is not a direct child of 'first'."); + first = first.Next; firstOffset = 0; first._nodeCount = 0; @@ -658,7 +672,7 @@ private TreeSpan MapSpanDownToChild(TreeSpan span, int childIndex) return TreeSpan.Intersect(mappedFullSpan, _nodes[childIndex].Span); } - private IndexNode InsertIndex(int branchingFactor, bool isAppend, int index, Node node) + private IndexNode? InsertIndex(int branchingFactor, bool isAppend, int index, Node node) { if (_nodeCount < _nodes.Length) { diff --git a/TunnelVisionLabs.Collections.Trees/TreeList`1+LeafNode.cs b/TunnelVisionLabs.Collections.Trees/TreeList`1+LeafNode.cs index 9c5273b..f6cbdb9 100644 --- a/TunnelVisionLabs.Collections.Trees/TreeList`1+LeafNode.cs +++ b/TunnelVisionLabs.Collections.Trees/TreeList`1+LeafNode.cs @@ -12,7 +12,7 @@ public partial class TreeList private sealed class LeafNode : Node { private readonly T[] _data; - private LeafNode _next; + private LeafNode? _next; private int _count; internal LeafNode(int branchingFactor) @@ -24,11 +24,11 @@ internal LeafNode(int branchingFactor) internal override LeafNode FirstLeaf => this; - internal override Node NextNode => Next; + internal override Node? NextNode => Next; - internal override Node FirstChild => null; + internal override Node? FirstChild => null; - internal LeafNode Next => _next; + internal LeafNode? Next => _next; internal override T this[int index] { @@ -69,7 +69,7 @@ internal override int LastIndexOf(T item, TreeSpan span) return Array.LastIndexOf(_data, item, span.EndInclusive, span.Count); } - internal override TreeList.Node ConvertAll(Func converter, TreeList.Node convertedNextNode) + internal override TreeList.Node ConvertAll(Func converter, TreeList.Node? convertedNextNode) { var result = new TreeList.LeafNode(_data.Length); @@ -78,12 +78,12 @@ internal override TreeList.Node ConvertAll(Func co result._data[i] = converter(_data[i]); } - result._next = (TreeList.LeafNode)convertedNextNode; + result._next = (TreeList.LeafNode?)convertedNextNode; result._count = _count; return result; } - internal override Node Insert(int branchingFactor, bool isAppend, int index, T item) + internal override Node? Insert(int branchingFactor, bool isAppend, int index, T item) { if (_count < _data.Length) { @@ -98,7 +98,7 @@ internal override Node Insert(int branchingFactor, bool isAppend, int index, T i if (isAppend) { // optimize the case of adding at the end of the overall list - var result = (LeafNode)Empty.Insert(branchingFactor, isAppend, 0, item); + var result = (LeafNode?)Empty.Insert(branchingFactor, isAppend, 0, item); _next = result; return result; } @@ -142,15 +142,15 @@ internal override Node Insert(int branchingFactor, bool isAppend, int index, T i } } - internal override Node InsertRange(int branchingFactor, bool isAppend, int index, IEnumerable collection) + internal override Node? InsertRange(int branchingFactor, bool isAppend, int index, IEnumerable collection) { Node insertionNode = this; - Node lastLeaf = null; + Node? lastLeaf = null; foreach (T item in collection) { Debug.Assert(index >= 0 && index <= ((LeafNode)insertionNode)._data.Length, "Assertion failed: index >= 0 && index <= ((LeafNode)insertionNode)._data.Length"); - Node newLastLeaf = insertionNode.Insert(branchingFactor, isAppend, index, item); + Node? newLastLeaf = insertionNode.Insert(branchingFactor, isAppend, index, item); if (newLastLeaf != null) { // this insertion resulted in a split, so at minimum 'index' must be updated @@ -204,7 +204,7 @@ internal override bool RemoveLast() { Debug.Assert(_count > 1, $"Assertion failed: _count > 1"); _count--; - _data[_count] = default; + _data[_count] = default!; return false; } } @@ -216,7 +216,7 @@ internal override bool RemoveAt(int index) _data[i] = _data[i + 1]; } - _data[_count - 1] = default; + _data[_count - 1] = default!; _count--; if (_count < _data.Length / 2 && _next != null) @@ -281,9 +281,9 @@ internal override int BinarySearch(TreeSpan span, T item, IComparer comparer) internal override bool TrimExcess() { bool changedAnything = false; - LeafNode first = this; + LeafNode? first = this; int firstOffset = 0; - LeafNode second = null; + LeafNode? second = null; int secondOffset = 0; while (first != null) { @@ -310,7 +310,7 @@ internal override bool TrimExcess() first._count = firstOffset; for (int i = firstOffset; i < first._data.Length; i++) { - first._data[i] = default; + first._data[i] = default!; } first._next = null; diff --git a/TunnelVisionLabs.Collections.Trees/TreeList`1+Node.cs b/TunnelVisionLabs.Collections.Trees/TreeList`1+Node.cs index ba93947..98baf9d 100644 --- a/TunnelVisionLabs.Collections.Trees/TreeList`1+Node.cs +++ b/TunnelVisionLabs.Collections.Trees/TreeList`1+Node.cs @@ -21,17 +21,17 @@ internal abstract int Count get; } - internal abstract LeafNode FirstLeaf + internal abstract LeafNode? FirstLeaf { get; } - internal abstract Node NextNode + internal abstract Node? NextNode { get; } - internal abstract Node FirstChild + internal abstract Node? FirstChild { get; } @@ -49,7 +49,7 @@ internal static Node Insert(Node root, int branchingFactor, int index, T item) if (index > root.Count) throw new ArgumentOutOfRangeException(nameof(index)); - Node splitNode = root.Insert(branchingFactor, index == root.Count, index, item); + Node? splitNode = root.Insert(branchingFactor, index == root.Count, index, item); if (splitNode == null) return root; @@ -77,11 +77,11 @@ internal static Node InsertRange(Node root, int branchingFactor, int index, IEnu if (root == Empty) root = new LeafNode(branchingFactor); - Node splitNode = root.InsertRange(branchingFactor, index == root.Count, index, collection); + Node? splitNode = root.InsertRange(branchingFactor, index == root.Count, index, collection); while (splitNode != null) { // Make a new level, walking nodes on the previous root level from 'node' to 'splitNode' - IndexNode newRoot = new IndexNode(branchingFactor, root, splitNode, out IndexNode newSplitNode); + IndexNode newRoot = new IndexNode(branchingFactor, root, splitNode, out IndexNode? newSplitNode); root = newRoot; splitNode = newSplitNode == newRoot ? null : newSplitNode; } @@ -182,9 +182,9 @@ internal void Reverse(TreeSpan span) internal abstract int LastIndexOf(T item, TreeSpan span); - internal abstract Node Insert(int branchingFactor, bool isAppend, int index, T item); + internal abstract Node? Insert(int branchingFactor, bool isAppend, int index, T item); - internal abstract Node InsertRange(int branchingFactor, bool isAppend, int index, IEnumerable collection); + internal abstract Node? InsertRange(int branchingFactor, bool isAppend, int index, IEnumerable collection); internal abstract bool RemoveLast(); @@ -205,7 +205,7 @@ internal TreeList.Node ConvertAll(Func converter) return ConvertAll(converter, null); } - internal abstract TreeList.Node ConvertAll(Func converter, TreeList.Node convertedNextNode); + internal abstract TreeList.Node ConvertAll(Func converter, TreeList.Node? convertedNextNode); internal abstract bool TrimExcess(); @@ -221,11 +221,11 @@ internal override int Count } } - internal override LeafNode FirstLeaf => null; + internal override LeafNode? FirstLeaf => null; - internal override Node NextNode => null; + internal override Node? NextNode => null; - internal override Node FirstChild => null; + internal override Node? FirstChild => null; [ExcludeFromCodeCoverage] internal override T this[int index] @@ -316,7 +316,7 @@ internal override int BinarySearch(TreeSpan span, T item, IComparer comparer) return ~0; } - internal override TreeList.Node ConvertAll(Func converter, TreeList.Node convertedNextNode) + internal override TreeList.Node ConvertAll(Func converter, TreeList.Node? convertedNextNode) { return TreeList.Node.Empty; } diff --git a/TunnelVisionLabs.Collections.Trees/TreeList`1.cs b/TunnelVisionLabs.Collections.Trees/TreeList`1.cs index 5dc3733..c370679 100644 --- a/TunnelVisionLabs.Collections.Trees/TreeList`1.cs +++ b/TunnelVisionLabs.Collections.Trees/TreeList`1.cs @@ -7,6 +7,7 @@ namespace TunnelVisionLabs.Collections.Trees using System.Collections; using System.Collections.Generic; using System.Diagnostics; + using System.Diagnostics.CodeAnalysis; using System.Linq; using ICollection = System.Collections.ICollection; using IList = System.Collections.IList; @@ -92,7 +93,7 @@ public T this[int index] } } - object IList.this[int index] + object? IList.this[int index] { get { @@ -111,10 +112,11 @@ object IList.this[int index] try { - this[index] = (T)value; + this[index] = (T)value!; } catch (InvalidCastException) { + Debug.Assert(value is object, $"Assertion failed: {nameof(value)} is object"); throw new ArgumentException($"The value \"{value.GetType()}\" isn't of type \"{typeof(T)}\" and can't be used in this generic collection.", nameof(value)); } } @@ -134,17 +136,18 @@ public void AddRange(IEnumerable collection) _version++; } - int IList.Add(object value) + int IList.Add(object? value) { if (value == null && default(T) != null) throw new ArgumentNullException(nameof(value)); try { - Add((T)value); + Add((T)value!); } catch (InvalidCastException) { + Debug.Assert(value is object, $"Assertion failed: {nameof(value)} is object"); throw new ArgumentException($"The value \"{value.GetType()}\" isn't of type \"{typeof(T)}\" and can't be used in this generic collection.", nameof(value)); } @@ -165,12 +168,12 @@ public bool Contains(T item) return IndexOf(item) >= 0; } - bool IList.Contains(object value) + bool IList.Contains(object? value) { if (value == null) { if (default(T) == null) - return Contains(default); + return Contains(default!); } else if (value is T) { @@ -223,7 +226,7 @@ void ICollection.CopyTo(Array dest, int index) try { int offset = index; - LeafNode leaf = _root.FirstLeaf; + LeafNode? leaf = _root.FirstLeaf; while (leaf != null) { leaf.CopyToArray(dest, offset); @@ -268,12 +271,12 @@ public int IndexOf(T item, int index, int count) return _root.IndexOf(item, new TreeSpan(index, count)); } - int IList.IndexOf(object value) + int IList.IndexOf(object? value) { if (value == null) { if (default(T) == null) - return IndexOf(default); + return IndexOf(default!); } else if (value is T) { @@ -295,7 +298,7 @@ public void InsertRange(int index, IEnumerable collection) _version++; } - void IList.Insert(int index, object value) + void IList.Insert(int index, object? value) { if (value == null && default(T) != null) throw new ArgumentNullException(nameof(value)); @@ -304,10 +307,11 @@ void IList.Insert(int index, object value) try { - Insert(index, (T)value); + Insert(index, (T)value!); } catch (InvalidCastException) { + Debug.Assert(value is object, $"Assertion failed: {nameof(value)} is object"); throw new ArgumentException(string.Format("The value \"{0}\" isn't of type \"{1}\" and can't be used in this generic collection.", value.GetType(), typeof(T)), nameof(value)); } } @@ -324,7 +328,7 @@ public bool Remove(T item) return false; } - void IList.Remove(object value) + void IList.Remove(object? value) { int index = ((IList)this).IndexOf(value); if (index >= 0) @@ -360,12 +364,12 @@ public int BinarySearch(T item) return BinarySearch(0, Count, item, null); } - public int BinarySearch(T item, IComparer comparer) + public int BinarySearch(T item, IComparer? comparer) { return BinarySearch(0, Count, item, comparer); } - public int BinarySearch(int index, int count, T item, IComparer comparer) + public int BinarySearch(int index, int count, T item, IComparer? comparer) { if (index < 0) throw new ArgumentOutOfRangeException(nameof(index)); @@ -388,6 +392,7 @@ public bool Exists(Predicate match) return FindIndex(match) >= 0; } + [return: MaybeNull] public T Find(Predicate match) { if (match == null) @@ -434,6 +439,7 @@ public int FindIndex(int startIndex, int count, Predicate match) return _root.FindIndex(new TreeSpan(startIndex, count), match); } + [return: MaybeNull] public T FindLast(Predicate match) { int index = FindLastIndex(match); @@ -557,12 +563,12 @@ public void Sort() Sort(0, Count, null); } - public void Sort(IComparer comparer) + public void Sort(IComparer? comparer) { Sort(0, Count, comparer); } - public void Sort(int index, int count, IComparer comparer) + public void Sort(int index, int count, IComparer? comparer) { if (index < 0) throw new ArgumentOutOfRangeException(nameof(index)); diff --git a/TunnelVisionLabs.Collections.Trees/TreeQueue`1+Enumerator.cs b/TunnelVisionLabs.Collections.Trees/TreeQueue`1+Enumerator.cs index a7feea6..71e2402 100644 --- a/TunnelVisionLabs.Collections.Trees/TreeQueue`1+Enumerator.cs +++ b/TunnelVisionLabs.Collections.Trees/TreeQueue`1+Enumerator.cs @@ -19,7 +19,7 @@ internal Enumerator(TreeList.Enumerator enumerator) public T Current => _enumerator.Current; - object IEnumerator.Current => _enumerator.Current; + object? IEnumerator.Current => _enumerator.Current; public void Dispose() => _enumerator.Dispose(); diff --git a/TunnelVisionLabs.Collections.Trees/TreeQueue`1.cs b/TunnelVisionLabs.Collections.Trees/TreeQueue`1.cs index bfcfe4f..e14f038 100644 --- a/TunnelVisionLabs.Collections.Trees/TreeQueue`1.cs +++ b/TunnelVisionLabs.Collections.Trees/TreeQueue`1.cs @@ -6,6 +6,7 @@ namespace TunnelVisionLabs.Collections.Trees using System; using System.Collections; using System.Collections.Generic; + using System.Diagnostics.CodeAnalysis; using ICollection = System.Collections.ICollection; public partial class TreeQueue : IReadOnlyCollection, ICollection @@ -58,7 +59,7 @@ public T Dequeue() public void TrimExcess() => _treeList.TrimExcess(); - public bool TryPeek(out T result) + public bool TryPeek([MaybeNullWhen(false)] out T result) { if (_treeList.Count == 0) { @@ -70,7 +71,7 @@ public bool TryPeek(out T result) return true; } - public bool TryDequeue(out T result) + public bool TryDequeue([MaybeNullWhen(false)] out T result) { if (_treeList.Count == 0) { diff --git a/TunnelVisionLabs.Collections.Trees/TreeSet`1+Enumerator.cs b/TunnelVisionLabs.Collections.Trees/TreeSet`1+Enumerator.cs index 76fe581..920dd1d 100644 --- a/TunnelVisionLabs.Collections.Trees/TreeSet`1+Enumerator.cs +++ b/TunnelVisionLabs.Collections.Trees/TreeSet`1+Enumerator.cs @@ -19,7 +19,7 @@ internal Enumerator(SortedTreeList<(int hashCode, T value)>.Enumerator enumerato public T Current => _enumerator.Current.value; - object IEnumerator.Current => Current; + object? IEnumerator.Current => Current; public void Dispose() => _enumerator.Dispose(); diff --git a/TunnelVisionLabs.Collections.Trees/TreeSet`1.cs b/TunnelVisionLabs.Collections.Trees/TreeSet`1.cs index d1cb718..bb8fbc1 100644 --- a/TunnelVisionLabs.Collections.Trees/TreeSet`1.cs +++ b/TunnelVisionLabs.Collections.Trees/TreeSet`1.cs @@ -7,6 +7,7 @@ namespace TunnelVisionLabs.Collections.Trees using System.Collections; using System.Collections.Generic; using System.Diagnostics; + using System.Diagnostics.CodeAnalysis; using System.Linq; public partial class TreeSet : ISet, IReadOnlyCollection, ICollection @@ -15,7 +16,7 @@ public partial class TreeSet : ISet, IReadOnlyCollection, ICollection private readonly SortedTreeList<(int hashCode, T value)> _sortedList; public TreeSet() - : this(default(IEqualityComparer)) + : this(default(IEqualityComparer?)) { } @@ -24,13 +25,13 @@ public TreeSet(IEnumerable collection) { } - public TreeSet(IEqualityComparer comparer) + public TreeSet(IEqualityComparer? comparer) { _comparer = comparer ?? EqualityComparer.Default; _sortedList = new SortedTreeList<(int hashCode, T value)>(SetHelper.WrapperComparer.Instance); } - public TreeSet(IEnumerable collection, IEqualityComparer comparer) + public TreeSet(IEnumerable collection, IEqualityComparer? comparer) : this(comparer) { if (collection == null) @@ -44,13 +45,13 @@ public TreeSet(int branchingFactor) { } - public TreeSet(int branchingFactor, IEqualityComparer comparer) + public TreeSet(int branchingFactor, IEqualityComparer? comparer) { _comparer = comparer ?? EqualityComparer.Default; _sortedList = new SortedTreeList<(int hashCode, T value)>(branchingFactor, SetHelper.WrapperComparer.Instance); } - public TreeSet(int branchingFactor, IEnumerable collection, IEqualityComparer comparer) + public TreeSet(int branchingFactor, IEnumerable collection, IEqualityComparer? comparer) : this(branchingFactor, comparer) { if (collection == null) @@ -69,7 +70,7 @@ public TreeSet(int branchingFactor, IEnumerable collection, IEqualityComparer object ICollection.SyncRoot => this; - public static IEqualityComparer> CreateSetComparer() + public static IEqualityComparer?> CreateSetComparer() { return TreeSetEqualityComparer.Default; } @@ -449,7 +450,7 @@ public void UnionWith(IEnumerable other) public void TrimExcess() => _sortedList.TrimExcess(); - public bool TryGetValue(T equalValue, out T actualValue) + public bool TryGetValue(T equalValue, [MaybeNullWhen(false)] out T actualValue) { int hashCode = _comparer.GetHashCode(equalValue); @@ -519,9 +520,9 @@ internal void Validate(ValidationRules validationRules) } } - private class TreeSetEqualityComparer : IEqualityComparer> + private class TreeSetEqualityComparer : IEqualityComparer?> { - public static readonly IEqualityComparer> Default = new TreeSetEqualityComparer(); + public static readonly IEqualityComparer?> Default = new TreeSetEqualityComparer(); private readonly IEqualityComparer _comparer = EqualityComparer.Default; @@ -529,7 +530,7 @@ private TreeSetEqualityComparer() { } - public override bool Equals(object obj) + public override bool Equals(object? obj) { if (!(obj is TreeSetEqualityComparer comparer)) return false; @@ -542,7 +543,7 @@ public override int GetHashCode() return _comparer.GetHashCode(); } - public bool Equals(TreeSet x, TreeSet y) + public bool Equals(TreeSet? x, TreeSet? y) { if (x is null) { @@ -580,7 +581,7 @@ public bool Equals(TreeSet x, TreeSet y) return true; } - public int GetHashCode(TreeSet obj) + public int GetHashCode(TreeSet? obj) { if (obj == null) return 0; diff --git a/TunnelVisionLabs.Collections.Trees/TreeSpan.cs b/TunnelVisionLabs.Collections.Trees/TreeSpan.cs index 2bcb88b..76f3801 100644 --- a/TunnelVisionLabs.Collections.Trees/TreeSpan.cs +++ b/TunnelVisionLabs.Collections.Trees/TreeSpan.cs @@ -66,7 +66,7 @@ public static TreeSpan Intersect(TreeSpan left, TreeSpan right) public bool IsProperSubspanOf(TreeSpan other) => Count < other.Count && IsSubspanOf(other); - public override bool Equals(object obj) + public override bool Equals(object? obj) { if (!(obj is TreeSpan other)) return false; diff --git a/TunnelVisionLabs.Collections.Trees/TreeStack`1+Enumerator.cs b/TunnelVisionLabs.Collections.Trees/TreeStack`1+Enumerator.cs index 1b201f2..b4a6d83 100644 --- a/TunnelVisionLabs.Collections.Trees/TreeStack`1+Enumerator.cs +++ b/TunnelVisionLabs.Collections.Trees/TreeStack`1+Enumerator.cs @@ -19,7 +19,7 @@ internal Enumerator(TreeList.Enumerator enumerator) public T Current => _enumerator.Current; - object IEnumerator.Current => _enumerator.Current; + object? IEnumerator.Current => _enumerator.Current; public void Dispose() => _enumerator.Dispose(); diff --git a/TunnelVisionLabs.Collections.Trees/TreeStack`1.cs b/TunnelVisionLabs.Collections.Trees/TreeStack`1.cs index 1499639..d7b5525 100644 --- a/TunnelVisionLabs.Collections.Trees/TreeStack`1.cs +++ b/TunnelVisionLabs.Collections.Trees/TreeStack`1.cs @@ -6,6 +6,7 @@ namespace TunnelVisionLabs.Collections.Trees using System; using System.Collections; using System.Collections.Generic; + using System.Diagnostics.CodeAnalysis; using ICollection = System.Collections.ICollection; public partial class TreeStack : IReadOnlyCollection, ICollection @@ -58,7 +59,7 @@ public T Pop() public void TrimExcess() => _treeList.TrimExcess(); - public bool TryPeek(out T result) + public bool TryPeek([MaybeNullWhen(false)] out T result) { if (_treeList.Count == 0) { @@ -70,7 +71,7 @@ public bool TryPeek(out T result) return true; } - public bool TryPop(out T result) + public bool TryPop([MaybeNullWhen(false)] out T result) { if (_treeList.Count == 0) { diff --git a/TunnelVisionLabs.Collections.Trees/TunnelVisionLabs.Collections.Trees.csproj b/TunnelVisionLabs.Collections.Trees/TunnelVisionLabs.Collections.Trees.csproj index 59a2e04..436aafd 100644 --- a/TunnelVisionLabs.Collections.Trees/TunnelVisionLabs.Collections.Trees.csproj +++ b/TunnelVisionLabs.Collections.Trees/TunnelVisionLabs.Collections.Trees.csproj @@ -2,10 +2,14 @@ - net45;netstandard1.1;netstandard2.0 + net45;netstandard1.1;netstandard2.0;netstandard2.1 true + + true + + ..\TunnelVisionLabs.Collections.Trees.ruleset