RecyclableArrayList renamed to RecyclableList

This commit is contained in:
mlemanczyk committed 2023-05-21 20:43:33 +02:00
1 parent cf0c86d353
commit 1a723c6f4f
37 files changed
+171 -171

No files matched your search

+1 -1
View File
@@ -5,4 +5,4 @@
using System.Diagnostics.CodeAnalysis;
[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "<Pending>", Scope = "member", Target = "~F:Recyclable.Collections.RecyclableArrayList`1._count")]
[assembly: SuppressMessage("Style", "IDE0032:Use auto property", Justification = "<Pending>", Scope = "member", Target = "~F:Recyclable.Collections.RecyclableList`1._count")]
+4 -4
View File
@@ -7,10 +7,10 @@ namespace Recyclable.Collections
public static class ListExtensions
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool Contains<T>(this RecyclableArrayList<T[]> arrays, T item) => arrays.Any(x => x.Contains(item));
public static bool Contains<T>(this RecyclableList<T[]> arrays, T item) => arrays.Any(x => x.Contains(item));
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void CopyTo<T>(this RecyclableArrayList<T[]> arrays, long startingIndex, int blockSize, int lastBlockSize, T[] destinationArray, int destinationArrayIndex)
public static void CopyTo<T>(this RecyclableList<T[]> arrays, long startingIndex, int blockSize, int lastBlockSize, T[] destinationArray, int destinationArrayIndex)
{
Span<T> arrayMemory = destinationArray.AsSpan();
arrayMemory = arrayMemory[destinationArrayIndex..];
@@ -49,7 +49,7 @@ namespace Recyclable.Collections
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static IEnumerable<T> Enumerate<T>(this RecyclableArrayList<T[]> arrays, int chunkSize, long totalCount)
public static IEnumerable<T> Enumerate<T>(this RecyclableList<T[]> arrays, int chunkSize, long totalCount)
{
long currentCount = 0;
for (var arrayIdx = 0; (arrayIdx < arrays.Count) && (currentCount < totalCount); arrayIdx++)
@@ -104,7 +104,7 @@ namespace Recyclable.Collections
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static long LongIndexOf<T>(this RecyclableArrayList<T[]> arrays, int blockSize, T item, IEqualityComparer<T> comparer)
public static long LongIndexOf<T>(this RecyclableList<T[]> arrays, int blockSize, T item, IEqualityComparer<T> comparer)
{
for (var arrayIdx = 0; arrayIdx < arrays.Count; arrayIdx++)
{
@@ -4,7 +4,7 @@ using System.Runtime.CompilerServices;
namespace Recyclable.Collections
{
public class RecyclableArrayList<T> : IList<T>, IDisposable
public class RecyclableList<T> : IList<T>, IDisposable
{
private static readonly ArrayPool<T> _arrayPool = ArrayPool<T>.Create();
@@ -43,7 +43,7 @@ namespace Recyclable.Collections
}
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
protected static int EnsureCapacity(RecyclableArrayList<T> list, int requestedCapacity)
protected static int EnsureCapacity(RecyclableList<T> list, int requestedCapacity)
{
int newCapacity;
switch (list._capacity > 0)
@@ -69,13 +69,13 @@ namespace Recyclable.Collections
}
#pragma warning disable CS8618 // _memory will be initialized when the 1st item is added
public RecyclableArrayList()
public RecyclableList()
#pragma warning restore CS8618
{
}
#pragma warning disable CS8618 // _memory will be initialized when the 1st item is added
public RecyclableArrayList(int initialCapacity)
public RecyclableList(int initialCapacity)
#pragma warning restore CS8618
{
if (initialCapacity > 0)
@@ -86,34 +86,34 @@ namespace Recyclable.Collections
}
#pragma warning disable CS8618 // _memory will be initialized when the 1st item is added
public RecyclableArrayList(RecyclableArrayList<T> source)
public RecyclableList(RecyclableList<T> source)
#pragma warning restore CS8618
{
AddRange(source);
}
#pragma warning disable CS8618 // _memory will be initialized when the 1st item is added
public RecyclableArrayList(in T[] source)
public RecyclableList(in T[] source)
#pragma warning restore CS8618
{
AddRange(source);
}
#pragma warning disable CS8618 // _memory will be initialized when the 1st item is added
public RecyclableArrayList(List<T> source)
public RecyclableList(List<T> source)
#pragma warning restore CS8618
{
AddRange(source);
}
#pragma warning disable CS8618 // _memory will be initialized when the 1st item is added
public RecyclableArrayList(IList<T> source)
public RecyclableList(IList<T> source)
#pragma warning restore CS8618
{
AddRange(source);
}
public RecyclableArrayList(IEnumerable<T> source, int initialCapacity = RecyclableDefaults.Capacity)
public RecyclableList(IEnumerable<T> source, int initialCapacity = RecyclableDefaults.Capacity)
{
_memoryBlock = Resize(_memoryBlock, initialCapacity);
_capacity = _memoryBlock.Length;
@@ -227,7 +227,7 @@ namespace Recyclable.Collections
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.AggressiveOptimization)]
public void AddRange(RecyclableArrayList<T> items)
public void AddRange(RecyclableList<T> items)
{
if (items.Count == 0)
{
@@ -258,12 +258,12 @@ namespace Recyclable.Collections
var sourceItemsCount = items.LongCount;
if (sourceItemsCount > int.MaxValue)
{
ThrowArgumentOutOfRangeException($"The number of items exceeds the maximum capacity of {nameof(RecyclableArrayList<T>)}, equal {int.MaxValue}, equal {int.MaxValue}. Please consider using {nameof(RecyclableLongList<T>)}, instead");
ThrowArgumentOutOfRangeException($"The number of items exceeds the maximum capacity of {nameof(RecyclableList<T>)}, equal {int.MaxValue}, equal {int.MaxValue}. Please consider using {nameof(RecyclableLongList<T>)}, instead");
}
if (_count + sourceItemsCount > int.MaxValue)
{
ThrowArgumentOutOfRangeException($"The total number of items in source and target table exceeds the maximum capacity of {nameof(RecyclableArrayList<T>)}, equal {int.MaxValue}. Please consider using {nameof(RecyclableLongList<T>)}, instead");
ThrowArgumentOutOfRangeException($"The total number of items in source and target table exceeds the maximum capacity of {nameof(RecyclableList<T>)}, equal {int.MaxValue}. Please consider using {nameof(RecyclableLongList<T>)}, instead");
}
int targetCapacity = _count + (int)sourceItemsCount;
@@ -315,9 +315,9 @@ namespace Recyclable.Collections
return;
}
if (source is RecyclableArrayList<T> sourceRecyclableArrayList)
if (source is RecyclableList<T> sourceRecyclableList)
{
AddRange(sourceRecyclableArrayList);
AddRange(sourceRecyclableList);
return;
}
@@ -393,7 +393,7 @@ namespace Recyclable.Collections
[MethodImpl(MethodImplOptions.NoInlining)]
public void CopyTo(T[] array, int arrayIndex) => Array.Copy(_memoryBlock, 0, array, arrayIndex, _count);
protected static IEnumerable<T> Enumerate(RecyclableArrayList<T> list)
protected static IEnumerable<T> Enumerate(RecyclableList<T> list)
{
int count = list._count;
var memory = list._memoryBlock;
+3 -3
View File
@@ -525,7 +525,7 @@ namespace Recyclable.Collections
_lastBlockWithData = targetBlockIndex - (itemsSpan.Length > 0 ? 0 : 1);
}
public void AddRange(RecyclableArrayList<T> items)
public void AddRange(RecyclableList<T> items)
{
if (items.Count == 0)
{
@@ -747,9 +747,9 @@ namespace Recyclable.Collections
return;
}
if (source is RecyclableArrayList<T> sourceRecyclableArrayList)
if (source is RecyclableList<T> sourceRecyclableList)
{
AddRange(sourceRecyclableArrayList);
AddRange(sourceRecyclableList);
return;
}
@@ -132,16 +132,16 @@ namespace Recyclable.Collections
public static RecyclableLongList<T> ToRecyclableLongList<T>(this List<T> values, int blockSize = RecyclableDefaults.BlockSize) => new(values, blockSize);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static RecyclableArrayList<T> ToRecyclableArrayList<T>(this IEnumerable<T> values) => new(values);
public static RecyclableList<T> ToRecyclableList<T>(this IEnumerable<T> values) => new(values);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static RecyclableArrayList<T> ToRecyclableArrayList<T>(this T[] values) => new(values);
public static RecyclableList<T> ToRecyclableList<T>(this T[] values) => new(values);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static RecyclableArrayList<T> ToRecyclableArrayList<T>(this List<T> values) => new(values);
public static RecyclableList<T> ToRecyclableList<T>(this List<T> values) => new(values);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static RecyclableArrayList<T> ToRecyclableArrayList<T>(this RecyclableArrayList<T> values) => new(values);
public static RecyclableList<T> ToRecyclableList<T>(this RecyclableList<T> values) => new(values);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static RecyclableLongList<T> ToRecyclableLongList<T>(this IEnumerable<T> values, int minBlockSize = RecyclableDefaults.BlockSize) => new(values, minBlockSize: minBlockSize);
+1 -1
View File
@@ -10,7 +10,7 @@ namespace Recyclable.Collections
private static readonly IEqualityComparer<T> _equalityComparer = EqualityComparer<T>.Default;
private bool _disposedValue;
private RecyclableArrayList<T[]> Memory { get; }
private RecyclableList<T[]> Memory { get; }
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static T Dequeue(RecyclableQueue<T> queue)