10public static class ImmutableSortedSet
73 return source.ToImmutableSortedSet(
null);
82[DebuggerDisplay(
"Count = {Count}")]
84public sealed class ImmutableSortedSet<T> :
IImmutableSet<T>,
IReadOnlyCollection<T>,
IEnumerable<T>,
IEnumerable,
ISortKeyCollection<T>,
IReadOnlySet<T>,
IReadOnlyList<T>,
IList<T>,
ICollection<T>,
ISet<T>,
IList,
ICollection,
IStrongEnumerable<T, ImmutableSortedSet<T>.Enumerator>
86 [DebuggerDisplay(
"Count = {Count}")]
158 bool ICollection.IsSynchronized =>
false;
161 object ICollection.SyncRoot
412 value.ClearFastWhenEmpty();
439 stack.ClearFastWhenEmpty();
463 while (!
node.IsEmpty)
471 [DebuggerDisplay(
"{_key}")]
519 while (!
node._right.IsEmpty)
536 while (!
node._left.IsEmpty)
651 return new Node(
key,
this,
this);
711 while (!
node2._left.IsEmpty)
793 bool flag =
num2 < 0;
816 if (
tree._right.IsEmpty)
827 if (
tree._left.IsEmpty)
838 if (
tree._right.IsEmpty)
849 if (
tree._left.IsEmpty)
860 return tree._right._height -
tree._left._height;
904 int num = (
length - 1) / 2;
908 return new Node(items[
start +
num2], left, right, frozen:
true);
965 bool IList.IsFixedSize =>
true;
967 bool IList.IsReadOnly =>
true;
970 object ICollection.SyncRoot =>
this;
973 bool ICollection.IsSynchronized =>
true;
1111 return other2.Union(
this);
1156 return num ==
Count;
1183 if (num ==
Count && flag)
1226 return num ==
Count;
1451 foreach (T
item in items.GetEnumerableDisposable<T,
Enumerator>())
1482 if (
list.Count == 0)
1493 list.Sort(keyComparer);
1495 for (
int i = 1; i <
list.Count; i++)
1497 if (keyComparer.Compare(
list[i],
list[i - 1]) != 0)
1502 list.RemoveRange(num,
list.Count - num);
bool ICollection< KeyValuePair< TKey, TValue > >. Remove(KeyValuePair< TKey, TValue > keyValuePair)
void CopyTo(KeyValuePair< TKey, TValue >[] array, int index)
bool ICollection< KeyValuePair< TKey, TValue > >. Contains(KeyValuePair< TKey, TValue > keyValuePair)
bool ICollection< KeyValuePair< TKey, TValue > >. IsReadOnly
Enumerator GetEnumerator()
void Add(TKey key, TValue value)
ImmutableSortedSet< T > ToImmutable()
IComparer< T > KeyComparer
bool IsSupersetOf(IEnumerable< T > other)
void UnionWith(IEnumerable< T > other)
bool IsSubsetOf(IEnumerable< T > other)
ImmutableSortedSet< T > _immutable
IEnumerable< T > Reverse()
ref readonly T ItemRef(int index)
ImmutableSortedSet< T >.Enumerator GetEnumerator()
bool IsProperSubsetOf(IEnumerable< T > other)
bool IsProperSupersetOf(IEnumerable< T > other)
Builder(ImmutableSortedSet< T > set)
void ExceptWith(IEnumerable< T > other)
bool TryGetValue(T equalValue, out T actualValue)
bool Overlaps(IEnumerable< T > other)
bool SetEquals(IEnumerable< T > other)
void SymmetricExceptWith(IEnumerable< T > other)
void IntersectWith(IEnumerable< T > other)
static bool IsRightHeavy(Node tree)
Enumerator GetEnumerator()
Node Add(T key, IComparer< T > comparer, out bool mutated)
int IndexOf(T key, IComparer< T > comparer)
Node(T key, Node left, Node right, bool frozen=false)
Node Search(T key, IComparer< T > comparer)
static readonly Node EmptyNode
static Node DoubleRight(Node tree)
bool Contains(T key, IComparer< T > comparer)
static Node NodeTreeFromList(IOrderedCollection< T > items, int start, int length)
static bool IsLeftHeavy(Node tree)
Enumerator GetEnumerator(Builder builder)
void CopyTo(T[] array, int arrayIndex)
static Node MakeBalanced(Node tree)
static Node RotateLeft(Node tree)
static int Balance(Node tree)
Node Mutate(Node left=null, Node right=null)
Node Remove(T key, IComparer< T > comparer, out bool mutated)
ref readonly T ItemRefUnchecked(int index)
static Node RotateRight(Node tree)
ref readonly T ItemRef(int index)
void CopyTo(Array array, int arrayIndex)
static Node DoubleLeft(Node tree)
IEnumerator< T > Reverse()
IEnumerator< T > GetEnumerator()
ReverseEnumerable(Node root)
static ImmutableSortedSet< TSource > ToImmutableSortedSet< TSource >(this IEnumerable< TSource > source, IComparer< TSource >? comparer)
ImmutableSortedSet< T > Add(T value)
ref readonly T ItemRef(int index)
IEnumerator< T > IEnumerable< T >. GetEnumerator()
ImmutableSortedSet< T > Remove(T value)
bool TryGetValue(T equalValue, out T actualValue)
ImmutableSortedSet< T > WithComparer(IComparer< T >? comparer)
ImmutableSortedSet(IComparer< T >? comparer=null)
bool IsSubsetOf(IEnumerable< T > other)
ImmutableSortedSet< T > Wrap(Node root)
bool Overlaps(IEnumerable< T > other)
bool IsProperSubsetOf(IEnumerable< T > other)
ImmutableSortedSet< T > Intersect(IEnumerable< T > other)
IEnumerable< T > Reverse()
ImmutableSortedSet< T > LeafToRootRefill(IEnumerable< T > addedItems)
IComparer< T > KeyComparer
ImmutableSortedSet< T > UnionIncremental(IEnumerable< T > items)
static ImmutableSortedSet< T > Wrap(Node root, IComparer< T > comparer)
bool SetEquals(IEnumerable< T > other)
Enumerator GetEnumerator()
static bool TryCastToImmutableSortedSet(IEnumerable< T > sequence, [NotNullWhen(true)] out ImmutableSortedSet< T > other)
bool IsProperSupersetOf(IEnumerable< T > other)
static ImmutableSortedSet< T > Create< T >()
static ImmutableSortedSet< T > CreateRange< T >(IEnumerable< T > items)
ImmutableSortedSet< T > SymmetricExcept(IEnumerable< T > other)
ImmutableSortedSet< T > Except(IEnumerable< T > other)
bool IsSupersetOf(IEnumerable< T > other)
ImmutableSortedSet(Node root, IComparer< T > comparer)
static ImmutableSortedSet< T >.Builder CreateBuilder< T >()
ImmutableSortedSet< T > Clear()
readonly IComparer< T > _comparer
ImmutableSortedSet< T > Union(IEnumerable< T > other)
static void Range(bool condition, string? parameterName, string? message=null)
static byte Max(byte val1, byte val2)
static string CollectionModifiedDuringEnumeration
static int CompareExchange(ref int location1, int value, int comparand)
void CopyTo(Array array, int index)
IEnumerator GetEnumerator()
void Insert(int index, object? value)
bool Contains(object? value)
void Remove(object? value)
int IndexOf(object? value)
static readonly SecureObjectPool< Stack< RefAsValueType< Node > >, Enumerator > s_enumeratingStacks
readonly Builder _builder
Enumerator(Node root, Builder? builder=null, bool reverse=false)
int _enumeratingBuilderVersion
object? IEnumerator. Current
SecurePooledObject< Stack< RefAsValueType< Node > > > _stack