Add RecyclableSortedSet and long list sort extensions
This commit is contained in:
1 parent
06987cfb0f
commit
80499d0936
3 files changed
+322
No files matched your search
@@ -0,0 +1,39 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Collections.Generic;
|
||||
using Recyclable.Collections.Linq;
|
||||
|
||||
namespace Recyclable.Collections
|
||||
{
|
||||
[Obsolete("It'll be moved to Recyclable.Collections.Compatibility.List NuGet package in the next release.")]
|
||||
public static class zRecyclableLongListCompatibilityListSorted
|
||||
{
|
||||
public static void Sort<T>(this RecyclableLongList<T> list)
|
||||
{
|
||||
QuickSortExtensions<T>.QuickSort(list);
|
||||
list._version++;
|
||||
}
|
||||
|
||||
public static void Sort<T>(this RecyclableLongList<T> list, Comparison<T> comparison)
|
||||
{
|
||||
QuickSortExtensions<T>.QuickSort(list, new ComparisonToComparerAdapter<T>(comparison), new SystemRandomNumberGenerator());
|
||||
list._version++;
|
||||
}
|
||||
|
||||
public static void Sort<T>(this RecyclableLongList<T> list, IComparer<T>? comparer)
|
||||
{
|
||||
QuickSortExtensions<T>.QuickSort(list, comparer ?? Comparer<T>.Default, new SystemRandomNumberGenerator());
|
||||
list._version++;
|
||||
}
|
||||
|
||||
public static void Sort<T>(this RecyclableLongList<T> list, long index, long count, IComparer<T>? comparer)
|
||||
{
|
||||
if (count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QuickSortExtensions<T>.QuickSort(list, (int)index, (int)(index + count - 1), comparer ?? Comparer<T>.Default, new SystemRandomNumberGenerator());
|
||||
list._version++;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user