Recyclable.AddRange fixed to ignore empty sources

This commit is contained in:
Marek Lemańczyk committed 2023-03-12 03:23:13 +01:00
1 parent 025cdb3073
commit efb393e13f
3 files changed
+95

No files matched your search

+25
View File
@@ -275,6 +275,11 @@ namespace Recyclable.Collections
public void AddRange(in T[] items)
{
if (items.LongLength == 0)
{
return;
}
long targetCapacity = _longCount + items.LongLength;
if (_capacity < targetCapacity)
{
@@ -309,6 +314,11 @@ namespace Recyclable.Collections
public void AddRange(RecyclableArrayList<T> items)
{
if (items.Count == 0)
{
return;
}
long targetCapacity = _longCount + items.Count;
if (_capacity < targetCapacity)
{
@@ -343,6 +353,11 @@ namespace Recyclable.Collections
public void AddRange(RecyclableList<T> items)
{
if (items.LongCount == 0)
{
return;
}
long itemsCount = items.LongCount,
targetCapacity = _longCount + itemsCount;
@@ -410,6 +425,11 @@ namespace Recyclable.Collections
public void AddRange(List<T> items)
{
if (items.Count == 0)
{
return;
}
long targetCapacity = _longCount + items.Count;
if (_capacity < targetCapacity)
{
@@ -445,6 +465,11 @@ namespace Recyclable.Collections
public void AddRange(IList<T> items)
{
if (items.Count == 0)
{
return;
}
long targetCapacity = _longCount + items.Count;
if (_capacity < targetCapacity)
{