using System; using Unity.Collections.LowLevel.Unsafe; namespace Unity.Collections.LowLevel.Unsafe { /// /// Provides extension methods for sets. /// public unsafe static class HashSetExtensions { /// /// Removes the values from this set which are also present in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void ExceptWith(this ref NativeHashSet container, UnsafeHashSet other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Remove(item); } } /// /// Removes the values from this set which are absent in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void IntersectWith(this ref NativeHashSet container, UnsafeHashSet other) where T : unmanaged, IEquatable { var result = new UnsafeList(container.Count, Allocator.Temp); foreach (var item in other) { if (container.Contains(item)) { result.Add(item); } } container.Clear(); container.UnionWith(result); result.Dispose(); } /// /// Adds all values from a collection to this set. /// /// The type of values. /// The set to add values to. /// The collection to copy values from. public static void UnionWith(this ref NativeHashSet container, UnsafeHashSet other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Add(item); } } /// /// Removes the values from this set which are also present in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void ExceptWith(this ref NativeHashSet container, UnsafeHashSet.ReadOnly other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Remove(item); } } /// /// Removes the values from this set which are absent in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void IntersectWith(this ref NativeHashSet container, UnsafeHashSet.ReadOnly other) where T : unmanaged, IEquatable { var result = new UnsafeList(container.Count, Allocator.Temp); foreach (var item in other) { if (container.Contains(item)) { result.Add(item); } } container.Clear(); container.UnionWith(result); result.Dispose(); } /// /// Adds all values from a collection to this set. /// /// The type of values. /// The set to add values to. /// The collection to copy values from. public static void UnionWith(this ref NativeHashSet container, UnsafeHashSet.ReadOnly other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Add(item); } } /// /// Removes the values from this set which are also present in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void ExceptWith(this ref NativeHashSet container, UnsafeParallelHashSet other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Remove(item); } } /// /// Removes the values from this set which are absent in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void IntersectWith(this ref NativeHashSet container, UnsafeParallelHashSet other) where T : unmanaged, IEquatable { var result = new UnsafeList(container.Count, Allocator.Temp); foreach (var item in other) { if (container.Contains(item)) { result.Add(item); } } container.Clear(); container.UnionWith(result); result.Dispose(); } /// /// Adds all values from a collection to this set. /// /// The type of values. /// The set to add values to. /// The collection to copy values from. public static void UnionWith(this ref NativeHashSet container, UnsafeParallelHashSet other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Add(item); } } /// /// Removes the values from this set which are also present in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void ExceptWith(this ref NativeHashSet container, UnsafeParallelHashSet.ReadOnly other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Remove(item); } } /// /// Removes the values from this set which are absent in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void IntersectWith(this ref NativeHashSet container, UnsafeParallelHashSet.ReadOnly other) where T : unmanaged, IEquatable { var result = new UnsafeList(container.Count, Allocator.Temp); foreach (var item in other) { if (container.Contains(item)) { result.Add(item); } } container.Clear(); container.UnionWith(result); result.Dispose(); } /// /// Adds all values from a collection to this set. /// /// The type of values. /// The set to add values to. /// The collection to copy values from. public static void UnionWith(this ref NativeHashSet container, UnsafeParallelHashSet.ReadOnly other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Add(item); } } /// /// Removes the values from this set which are also present in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void ExceptWith(this ref NativeHashSet container, UnsafeList other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Remove(item); } } /// /// Removes the values from this set which are absent in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void IntersectWith(this ref NativeHashSet container, UnsafeList other) where T : unmanaged, IEquatable { var result = new UnsafeList(container.Count, Allocator.Temp); foreach (var item in other) { if (container.Contains(item)) { result.Add(item); } } container.Clear(); container.UnionWith(result); result.Dispose(); } /// /// Adds all values from a collection to this set. /// /// The type of values. /// The set to add values to. /// The collection to copy values from. public static void UnionWith(this ref NativeHashSet container, UnsafeList other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Add(item); } } /// /// Removes the values from this set which are also present in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void ExceptWith(this ref NativeParallelHashSet container, UnsafeHashSet other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Remove(item); } } /// /// Removes the values from this set which are absent in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void IntersectWith(this ref NativeParallelHashSet container, UnsafeHashSet other) where T : unmanaged, IEquatable { var result = new UnsafeList(container.Count(), Allocator.Temp); foreach (var item in other) { if (container.Contains(item)) { result.Add(item); } } container.Clear(); container.UnionWith(result); result.Dispose(); } /// /// Adds all values from a collection to this set. /// /// The type of values. /// The set to add values to. /// The collection to copy values from. public static void UnionWith(this ref NativeParallelHashSet container, UnsafeHashSet other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Add(item); } } /// /// Removes the values from this set which are also present in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void ExceptWith(this ref NativeParallelHashSet container, UnsafeHashSet.ReadOnly other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Remove(item); } } /// /// Removes the values from this set which are absent in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void IntersectWith(this ref NativeParallelHashSet container, UnsafeHashSet.ReadOnly other) where T : unmanaged, IEquatable { var result = new UnsafeList(container.Count(), Allocator.Temp); foreach (var item in other) { if (container.Contains(item)) { result.Add(item); } } container.Clear(); container.UnionWith(result); result.Dispose(); } /// /// Adds all values from a collection to this set. /// /// The type of values. /// The set to add values to. /// The collection to copy values from. public static void UnionWith(this ref NativeParallelHashSet container, UnsafeHashSet.ReadOnly other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Add(item); } } /// /// Removes the values from this set which are also present in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void ExceptWith(this ref NativeParallelHashSet container, UnsafeParallelHashSet other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Remove(item); } } /// /// Removes the values from this set which are absent in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void IntersectWith(this ref NativeParallelHashSet container, UnsafeParallelHashSet other) where T : unmanaged, IEquatable { var result = new UnsafeList(container.Count(), Allocator.Temp); foreach (var item in other) { if (container.Contains(item)) { result.Add(item); } } container.Clear(); container.UnionWith(result); result.Dispose(); } /// /// Adds all values from a collection to this set. /// /// The type of values. /// The set to add values to. /// The collection to copy values from. public static void UnionWith(this ref NativeParallelHashSet container, UnsafeParallelHashSet other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Add(item); } } /// /// Removes the values from this set which are also present in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void ExceptWith(this ref NativeParallelHashSet container, UnsafeParallelHashSet.ReadOnly other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Remove(item); } } /// /// Removes the values from this set which are absent in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void IntersectWith(this ref NativeParallelHashSet container, UnsafeParallelHashSet.ReadOnly other) where T : unmanaged, IEquatable { var result = new UnsafeList(container.Count(), Allocator.Temp); foreach (var item in other) { if (container.Contains(item)) { result.Add(item); } } container.Clear(); container.UnionWith(result); result.Dispose(); } /// /// Adds all values from a collection to this set. /// /// The type of values. /// The set to add values to. /// The collection to copy values from. public static void UnionWith(this ref NativeParallelHashSet container, UnsafeParallelHashSet.ReadOnly other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Add(item); } } /// /// Removes the values from this set which are also present in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void ExceptWith(this ref NativeParallelHashSet container, UnsafeList other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Remove(item); } } /// /// Removes the values from this set which are absent in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void IntersectWith(this ref NativeParallelHashSet container, UnsafeList other) where T : unmanaged, IEquatable { var result = new UnsafeList(container.Count(), Allocator.Temp); foreach (var item in other) { if (container.Contains(item)) { result.Add(item); } } container.Clear(); container.UnionWith(result); result.Dispose(); } /// /// Adds all values from a collection to this set. /// /// The type of values. /// The set to add values to. /// The collection to copy values from. public static void UnionWith(this ref NativeParallelHashSet container, UnsafeList other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Add(item); } } /// /// Removes the values from this set which are also present in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void ExceptWith(this ref UnsafeHashSet container, FixedList128Bytes other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Remove(item); } } /// /// Removes the values from this set which are absent in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void IntersectWith(this ref UnsafeHashSet container, FixedList128Bytes other) where T : unmanaged, IEquatable { var result = new UnsafeList(container.Count, Allocator.Temp); foreach (var item in other) { if (container.Contains(item)) { result.Add(item); } } container.Clear(); container.UnionWith(result); result.Dispose(); } /// /// Adds all values from a collection to this set. /// /// The type of values. /// The set to add values to. /// The collection to copy values from. public static void UnionWith(this ref UnsafeHashSet container, FixedList128Bytes other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Add(item); } } /// /// Removes the values from this set which are also present in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void ExceptWith(this ref UnsafeHashSet container, FixedList32Bytes other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Remove(item); } } /// /// Removes the values from this set which are absent in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void IntersectWith(this ref UnsafeHashSet container, FixedList32Bytes other) where T : unmanaged, IEquatable { var result = new UnsafeList(container.Count, Allocator.Temp); foreach (var item in other) { if (container.Contains(item)) { result.Add(item); } } container.Clear(); container.UnionWith(result); result.Dispose(); } /// /// Adds all values from a collection to this set. /// /// The type of values. /// The set to add values to. /// The collection to copy values from. public static void UnionWith(this ref UnsafeHashSet container, FixedList32Bytes other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Add(item); } } /// /// Removes the values from this set which are also present in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void ExceptWith(this ref UnsafeHashSet container, FixedList4096Bytes other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Remove(item); } } /// /// Removes the values from this set which are absent in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void IntersectWith(this ref UnsafeHashSet container, FixedList4096Bytes other) where T : unmanaged, IEquatable { var result = new UnsafeList(container.Count, Allocator.Temp); foreach (var item in other) { if (container.Contains(item)) { result.Add(item); } } container.Clear(); container.UnionWith(result); result.Dispose(); } /// /// Adds all values from a collection to this set. /// /// The type of values. /// The set to add values to. /// The collection to copy values from. public static void UnionWith(this ref UnsafeHashSet container, FixedList4096Bytes other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Add(item); } } /// /// Removes the values from this set which are also present in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void ExceptWith(this ref UnsafeHashSet container, FixedList512Bytes other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Remove(item); } } /// /// Removes the values from this set which are absent in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void IntersectWith(this ref UnsafeHashSet container, FixedList512Bytes other) where T : unmanaged, IEquatable { var result = new UnsafeList(container.Count, Allocator.Temp); foreach (var item in other) { if (container.Contains(item)) { result.Add(item); } } container.Clear(); container.UnionWith(result); result.Dispose(); } /// /// Adds all values from a collection to this set. /// /// The type of values. /// The set to add values to. /// The collection to copy values from. public static void UnionWith(this ref UnsafeHashSet container, FixedList512Bytes other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Add(item); } } /// /// Removes the values from this set which are also present in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void ExceptWith(this ref UnsafeHashSet container, FixedList64Bytes other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Remove(item); } } /// /// Removes the values from this set which are absent in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void IntersectWith(this ref UnsafeHashSet container, FixedList64Bytes other) where T : unmanaged, IEquatable { var result = new UnsafeList(container.Count, Allocator.Temp); foreach (var item in other) { if (container.Contains(item)) { result.Add(item); } } container.Clear(); container.UnionWith(result); result.Dispose(); } /// /// Adds all values from a collection to this set. /// /// The type of values. /// The set to add values to. /// The collection to copy values from. public static void UnionWith(this ref UnsafeHashSet container, FixedList64Bytes other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Add(item); } } /// /// Removes the values from this set which are also present in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void ExceptWith(this ref UnsafeHashSet container, NativeArray other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Remove(item); } } /// /// Removes the values from this set which are absent in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void IntersectWith(this ref UnsafeHashSet container, NativeArray other) where T : unmanaged, IEquatable { var result = new UnsafeList(container.Count, Allocator.Temp); foreach (var item in other) { if (container.Contains(item)) { result.Add(item); } } container.Clear(); container.UnionWith(result); result.Dispose(); } /// /// Adds all values from a collection to this set. /// /// The type of values. /// The set to add values to. /// The collection to copy values from. public static void UnionWith(this ref UnsafeHashSet container, NativeArray other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Add(item); } } /// /// Removes the values from this set which are also present in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void ExceptWith(this ref UnsafeHashSet container, NativeHashSet other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Remove(item); } } /// /// Removes the values from this set which are absent in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void IntersectWith(this ref UnsafeHashSet container, NativeHashSet other) where T : unmanaged, IEquatable { var result = new UnsafeList(container.Count, Allocator.Temp); foreach (var item in other) { if (container.Contains(item)) { result.Add(item); } } container.Clear(); container.UnionWith(result); result.Dispose(); } /// /// Adds all values from a collection to this set. /// /// The type of values. /// The set to add values to. /// The collection to copy values from. public static void UnionWith(this ref UnsafeHashSet container, NativeHashSet other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Add(item); } } /// /// Removes the values from this set which are also present in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void ExceptWith(this ref UnsafeHashSet container, NativeHashSet.ReadOnly other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Remove(item); } } /// /// Removes the values from this set which are absent in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void IntersectWith(this ref UnsafeHashSet container, NativeHashSet.ReadOnly other) where T : unmanaged, IEquatable { var result = new UnsafeList(container.Count, Allocator.Temp); foreach (var item in other) { if (container.Contains(item)) { result.Add(item); } } container.Clear(); container.UnionWith(result); result.Dispose(); } /// /// Adds all values from a collection to this set. /// /// The type of values. /// The set to add values to. /// The collection to copy values from. public static void UnionWith(this ref UnsafeHashSet container, NativeHashSet.ReadOnly other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Add(item); } } /// /// Removes the values from this set which are also present in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void ExceptWith(this ref UnsafeHashSet container, UnsafeHashSet other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Remove(item); } } /// /// Removes the values from this set which are absent in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void IntersectWith(this ref UnsafeHashSet container, UnsafeHashSet other) where T : unmanaged, IEquatable { var result = new UnsafeList(container.Count, Allocator.Temp); foreach (var item in other) { if (container.Contains(item)) { result.Add(item); } } container.Clear(); container.UnionWith(result); result.Dispose(); } /// /// Adds all values from a collection to this set. /// /// The type of values. /// The set to add values to. /// The collection to copy values from. public static void UnionWith(this ref UnsafeHashSet container, UnsafeHashSet other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Add(item); } } /// /// Removes the values from this set which are also present in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void ExceptWith(this ref UnsafeHashSet container, UnsafeHashSet.ReadOnly other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Remove(item); } } /// /// Removes the values from this set which are absent in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void IntersectWith(this ref UnsafeHashSet container, UnsafeHashSet.ReadOnly other) where T : unmanaged, IEquatable { var result = new UnsafeList(container.Count, Allocator.Temp); foreach (var item in other) { if (container.Contains(item)) { result.Add(item); } } container.Clear(); container.UnionWith(result); result.Dispose(); } /// /// Adds all values from a collection to this set. /// /// The type of values. /// The set to add values to. /// The collection to copy values from. public static void UnionWith(this ref UnsafeHashSet container, UnsafeHashSet.ReadOnly other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Add(item); } } /// /// Removes the values from this set which are also present in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void ExceptWith(this ref UnsafeHashSet container, NativeParallelHashSet other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Remove(item); } } /// /// Removes the values from this set which are absent in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void IntersectWith(this ref UnsafeHashSet container, NativeParallelHashSet other) where T : unmanaged, IEquatable { var result = new UnsafeList(container.Count, Allocator.Temp); foreach (var item in other) { if (container.Contains(item)) { result.Add(item); } } container.Clear(); container.UnionWith(result); result.Dispose(); } /// /// Adds all values from a collection to this set. /// /// The type of values. /// The set to add values to. /// The collection to copy values from. public static void UnionWith(this ref UnsafeHashSet container, NativeParallelHashSet other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Add(item); } } /// /// Removes the values from this set which are also present in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void ExceptWith(this ref UnsafeHashSet container, NativeParallelHashSet.ReadOnly other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Remove(item); } } /// /// Removes the values from this set which are absent in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void IntersectWith(this ref UnsafeHashSet container, NativeParallelHashSet.ReadOnly other) where T : unmanaged, IEquatable { var result = new UnsafeList(container.Count, Allocator.Temp); foreach (var item in other) { if (container.Contains(item)) { result.Add(item); } } container.Clear(); container.UnionWith(result); result.Dispose(); } /// /// Adds all values from a collection to this set. /// /// The type of values. /// The set to add values to. /// The collection to copy values from. public static void UnionWith(this ref UnsafeHashSet container, NativeParallelHashSet.ReadOnly other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Add(item); } } /// /// Removes the values from this set which are also present in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void ExceptWith(this ref UnsafeHashSet container, UnsafeParallelHashSet other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Remove(item); } } /// /// Removes the values from this set which are absent in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void IntersectWith(this ref UnsafeHashSet container, UnsafeParallelHashSet other) where T : unmanaged, IEquatable { var result = new UnsafeList(container.Count, Allocator.Temp); foreach (var item in other) { if (container.Contains(item)) { result.Add(item); } } container.Clear(); container.UnionWith(result); result.Dispose(); } /// /// Adds all values from a collection to this set. /// /// The type of values. /// The set to add values to. /// The collection to copy values from. public static void UnionWith(this ref UnsafeHashSet container, UnsafeParallelHashSet other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Add(item); } } /// /// Removes the values from this set which are also present in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void ExceptWith(this ref UnsafeHashSet container, UnsafeParallelHashSet.ReadOnly other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Remove(item); } } /// /// Removes the values from this set which are absent in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void IntersectWith(this ref UnsafeHashSet container, UnsafeParallelHashSet.ReadOnly other) where T : unmanaged, IEquatable { var result = new UnsafeList(container.Count, Allocator.Temp); foreach (var item in other) { if (container.Contains(item)) { result.Add(item); } } container.Clear(); container.UnionWith(result); result.Dispose(); } /// /// Adds all values from a collection to this set. /// /// The type of values. /// The set to add values to. /// The collection to copy values from. public static void UnionWith(this ref UnsafeHashSet container, UnsafeParallelHashSet.ReadOnly other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Add(item); } } /// /// Removes the values from this set which are also present in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void ExceptWith(this ref UnsafeHashSet container, NativeList other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Remove(item); } } /// /// Removes the values from this set which are absent in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void IntersectWith(this ref UnsafeHashSet container, NativeList other) where T : unmanaged, IEquatable { var result = new UnsafeList(container.Count, Allocator.Temp); foreach (var item in other) { if (container.Contains(item)) { result.Add(item); } } container.Clear(); container.UnionWith(result); result.Dispose(); } /// /// Adds all values from a collection to this set. /// /// The type of values. /// The set to add values to. /// The collection to copy values from. public static void UnionWith(this ref UnsafeHashSet container, NativeList other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Add(item); } } /// /// Removes the values from this set which are also present in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void ExceptWith(this ref UnsafeHashSet container, UnsafeList other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Remove(item); } } /// /// Removes the values from this set which are absent in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void IntersectWith(this ref UnsafeHashSet container, UnsafeList other) where T : unmanaged, IEquatable { var result = new UnsafeList(container.Count, Allocator.Temp); foreach (var item in other) { if (container.Contains(item)) { result.Add(item); } } container.Clear(); container.UnionWith(result); result.Dispose(); } /// /// Adds all values from a collection to this set. /// /// The type of values. /// The set to add values to. /// The collection to copy values from. public static void UnionWith(this ref UnsafeHashSet container, UnsafeList other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Add(item); } } /// /// Removes the values from this set which are also present in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void ExceptWith(this ref UnsafeParallelHashSet container, FixedList128Bytes other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Remove(item); } } /// /// Removes the values from this set which are absent in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void IntersectWith(this ref UnsafeParallelHashSet container, FixedList128Bytes other) where T : unmanaged, IEquatable { var result = new UnsafeList(container.Count(), Allocator.Temp); foreach (var item in other) { if (container.Contains(item)) { result.Add(item); } } container.Clear(); container.UnionWith(result); result.Dispose(); } /// /// Adds all values from a collection to this set. /// /// The type of values. /// The set to add values to. /// The collection to copy values from. public static void UnionWith(this ref UnsafeParallelHashSet container, FixedList128Bytes other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Add(item); } } /// /// Removes the values from this set which are also present in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void ExceptWith(this ref UnsafeParallelHashSet container, FixedList32Bytes other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Remove(item); } } /// /// Removes the values from this set which are absent in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void IntersectWith(this ref UnsafeParallelHashSet container, FixedList32Bytes other) where T : unmanaged, IEquatable { var result = new UnsafeList(container.Count(), Allocator.Temp); foreach (var item in other) { if (container.Contains(item)) { result.Add(item); } } container.Clear(); container.UnionWith(result); result.Dispose(); } /// /// Adds all values from a collection to this set. /// /// The type of values. /// The set to add values to. /// The collection to copy values from. public static void UnionWith(this ref UnsafeParallelHashSet container, FixedList32Bytes other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Add(item); } } /// /// Removes the values from this set which are also present in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void ExceptWith(this ref UnsafeParallelHashSet container, FixedList4096Bytes other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Remove(item); } } /// /// Removes the values from this set which are absent in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void IntersectWith(this ref UnsafeParallelHashSet container, FixedList4096Bytes other) where T : unmanaged, IEquatable { var result = new UnsafeList(container.Count(), Allocator.Temp); foreach (var item in other) { if (container.Contains(item)) { result.Add(item); } } container.Clear(); container.UnionWith(result); result.Dispose(); } /// /// Adds all values from a collection to this set. /// /// The type of values. /// The set to add values to. /// The collection to copy values from. public static void UnionWith(this ref UnsafeParallelHashSet container, FixedList4096Bytes other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Add(item); } } /// /// Removes the values from this set which are also present in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void ExceptWith(this ref UnsafeParallelHashSet container, FixedList512Bytes other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Remove(item); } } /// /// Removes the values from this set which are absent in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void IntersectWith(this ref UnsafeParallelHashSet container, FixedList512Bytes other) where T : unmanaged, IEquatable { var result = new UnsafeList(container.Count(), Allocator.Temp); foreach (var item in other) { if (container.Contains(item)) { result.Add(item); } } container.Clear(); container.UnionWith(result); result.Dispose(); } /// /// Adds all values from a collection to this set. /// /// The type of values. /// The set to add values to. /// The collection to copy values from. public static void UnionWith(this ref UnsafeParallelHashSet container, FixedList512Bytes other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Add(item); } } /// /// Removes the values from this set which are also present in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void ExceptWith(this ref UnsafeParallelHashSet container, FixedList64Bytes other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Remove(item); } } /// /// Removes the values from this set which are absent in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void IntersectWith(this ref UnsafeParallelHashSet container, FixedList64Bytes other) where T : unmanaged, IEquatable { var result = new UnsafeList(container.Count(), Allocator.Temp); foreach (var item in other) { if (container.Contains(item)) { result.Add(item); } } container.Clear(); container.UnionWith(result); result.Dispose(); } /// /// Adds all values from a collection to this set. /// /// The type of values. /// The set to add values to. /// The collection to copy values from. public static void UnionWith(this ref UnsafeParallelHashSet container, FixedList64Bytes other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Add(item); } } /// /// Removes the values from this set which are also present in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void ExceptWith(this ref UnsafeParallelHashSet container, NativeArray other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Remove(item); } } /// /// Removes the values from this set which are absent in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void IntersectWith(this ref UnsafeParallelHashSet container, NativeArray other) where T : unmanaged, IEquatable { var result = new UnsafeList(container.Count(), Allocator.Temp); foreach (var item in other) { if (container.Contains(item)) { result.Add(item); } } container.Clear(); container.UnionWith(result); result.Dispose(); } /// /// Adds all values from a collection to this set. /// /// The type of values. /// The set to add values to. /// The collection to copy values from. public static void UnionWith(this ref UnsafeParallelHashSet container, NativeArray other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Add(item); } } /// /// Removes the values from this set which are also present in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void ExceptWith(this ref UnsafeParallelHashSet container, NativeHashSet other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Remove(item); } } /// /// Removes the values from this set which are absent in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void IntersectWith(this ref UnsafeParallelHashSet container, NativeHashSet other) where T : unmanaged, IEquatable { var result = new UnsafeList(container.Count(), Allocator.Temp); foreach (var item in other) { if (container.Contains(item)) { result.Add(item); } } container.Clear(); container.UnionWith(result); result.Dispose(); } /// /// Adds all values from a collection to this set. /// /// The type of values. /// The set to add values to. /// The collection to copy values from. public static void UnionWith(this ref UnsafeParallelHashSet container, NativeHashSet other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Add(item); } } /// /// Removes the values from this set which are also present in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void ExceptWith(this ref UnsafeParallelHashSet container, NativeHashSet.ReadOnly other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Remove(item); } } /// /// Removes the values from this set which are absent in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void IntersectWith(this ref UnsafeParallelHashSet container, NativeHashSet.ReadOnly other) where T : unmanaged, IEquatable { var result = new UnsafeList(container.Count(), Allocator.Temp); foreach (var item in other) { if (container.Contains(item)) { result.Add(item); } } container.Clear(); container.UnionWith(result); result.Dispose(); } /// /// Adds all values from a collection to this set. /// /// The type of values. /// The set to add values to. /// The collection to copy values from. public static void UnionWith(this ref UnsafeParallelHashSet container, NativeHashSet.ReadOnly other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Add(item); } } /// /// Removes the values from this set which are also present in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void ExceptWith(this ref UnsafeParallelHashSet container, UnsafeHashSet other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Remove(item); } } /// /// Removes the values from this set which are absent in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void IntersectWith(this ref UnsafeParallelHashSet container, UnsafeHashSet other) where T : unmanaged, IEquatable { var result = new UnsafeList(container.Count(), Allocator.Temp); foreach (var item in other) { if (container.Contains(item)) { result.Add(item); } } container.Clear(); container.UnionWith(result); result.Dispose(); } /// /// Adds all values from a collection to this set. /// /// The type of values. /// The set to add values to. /// The collection to copy values from. public static void UnionWith(this ref UnsafeParallelHashSet container, UnsafeHashSet other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Add(item); } } /// /// Removes the values from this set which are also present in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void ExceptWith(this ref UnsafeParallelHashSet container, UnsafeHashSet.ReadOnly other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Remove(item); } } /// /// Removes the values from this set which are absent in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void IntersectWith(this ref UnsafeParallelHashSet container, UnsafeHashSet.ReadOnly other) where T : unmanaged, IEquatable { var result = new UnsafeList(container.Count(), Allocator.Temp); foreach (var item in other) { if (container.Contains(item)) { result.Add(item); } } container.Clear(); container.UnionWith(result); result.Dispose(); } /// /// Adds all values from a collection to this set. /// /// The type of values. /// The set to add values to. /// The collection to copy values from. public static void UnionWith(this ref UnsafeParallelHashSet container, UnsafeHashSet.ReadOnly other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Add(item); } } /// /// Removes the values from this set which are also present in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void ExceptWith(this ref UnsafeParallelHashSet container, NativeParallelHashSet other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Remove(item); } } /// /// Removes the values from this set which are absent in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void IntersectWith(this ref UnsafeParallelHashSet container, NativeParallelHashSet other) where T : unmanaged, IEquatable { var result = new UnsafeList(container.Count(), Allocator.Temp); foreach (var item in other) { if (container.Contains(item)) { result.Add(item); } } container.Clear(); container.UnionWith(result); result.Dispose(); } /// /// Adds all values from a collection to this set. /// /// The type of values. /// The set to add values to. /// The collection to copy values from. public static void UnionWith(this ref UnsafeParallelHashSet container, NativeParallelHashSet other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Add(item); } } /// /// Removes the values from this set which are also present in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void ExceptWith(this ref UnsafeParallelHashSet container, NativeParallelHashSet.ReadOnly other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Remove(item); } } /// /// Removes the values from this set which are absent in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void IntersectWith(this ref UnsafeParallelHashSet container, NativeParallelHashSet.ReadOnly other) where T : unmanaged, IEquatable { var result = new UnsafeList(container.Count(), Allocator.Temp); foreach (var item in other) { if (container.Contains(item)) { result.Add(item); } } container.Clear(); container.UnionWith(result); result.Dispose(); } /// /// Adds all values from a collection to this set. /// /// The type of values. /// The set to add values to. /// The collection to copy values from. public static void UnionWith(this ref UnsafeParallelHashSet container, NativeParallelHashSet.ReadOnly other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Add(item); } } /// /// Removes the values from this set which are also present in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void ExceptWith(this ref UnsafeParallelHashSet container, UnsafeParallelHashSet other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Remove(item); } } /// /// Removes the values from this set which are absent in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void IntersectWith(this ref UnsafeParallelHashSet container, UnsafeParallelHashSet other) where T : unmanaged, IEquatable { var result = new UnsafeList(container.Count(), Allocator.Temp); foreach (var item in other) { if (container.Contains(item)) { result.Add(item); } } container.Clear(); container.UnionWith(result); result.Dispose(); } /// /// Adds all values from a collection to this set. /// /// The type of values. /// The set to add values to. /// The collection to copy values from. public static void UnionWith(this ref UnsafeParallelHashSet container, UnsafeParallelHashSet other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Add(item); } } /// /// Removes the values from this set which are also present in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void ExceptWith(this ref UnsafeParallelHashSet container, UnsafeParallelHashSet.ReadOnly other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Remove(item); } } /// /// Removes the values from this set which are absent in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void IntersectWith(this ref UnsafeParallelHashSet container, UnsafeParallelHashSet.ReadOnly other) where T : unmanaged, IEquatable { var result = new UnsafeList(container.Count(), Allocator.Temp); foreach (var item in other) { if (container.Contains(item)) { result.Add(item); } } container.Clear(); container.UnionWith(result); result.Dispose(); } /// /// Adds all values from a collection to this set. /// /// The type of values. /// The set to add values to. /// The collection to copy values from. public static void UnionWith(this ref UnsafeParallelHashSet container, UnsafeParallelHashSet.ReadOnly other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Add(item); } } /// /// Removes the values from this set which are also present in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void ExceptWith(this ref UnsafeParallelHashSet container, NativeList other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Remove(item); } } /// /// Removes the values from this set which are absent in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void IntersectWith(this ref UnsafeParallelHashSet container, NativeList other) where T : unmanaged, IEquatable { var result = new UnsafeList(container.Count(), Allocator.Temp); foreach (var item in other) { if (container.Contains(item)) { result.Add(item); } } container.Clear(); container.UnionWith(result); result.Dispose(); } /// /// Adds all values from a collection to this set. /// /// The type of values. /// The set to add values to. /// The collection to copy values from. public static void UnionWith(this ref UnsafeParallelHashSet container, NativeList other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Add(item); } } /// /// Removes the values from this set which are also present in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void ExceptWith(this ref UnsafeParallelHashSet container, UnsafeList other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Remove(item); } } /// /// Removes the values from this set which are absent in another collection. /// /// The type of values. /// The set to remove values from. /// The collection to compare with. public static void IntersectWith(this ref UnsafeParallelHashSet container, UnsafeList other) where T : unmanaged, IEquatable { var result = new UnsafeList(container.Count(), Allocator.Temp); foreach (var item in other) { if (container.Contains(item)) { result.Add(item); } } container.Clear(); container.UnionWith(result); result.Dispose(); } /// /// Adds all values from a collection to this set. /// /// The type of values. /// The set to add values to. /// The collection to copy values from. public static void UnionWith(this ref UnsafeParallelHashSet container, UnsafeList other) where T : unmanaged, IEquatable { foreach (var item in other) { container.Add(item); } } } }