Merge branch 'Lab3' into Lab4

This commit is contained in:
zum 2024-03-21 19:13:46 +04:00
commit 56a45d4ae1

View File

@ -54,12 +54,11 @@ public class MassiveGenericObjects<T> : ICollectionGenericObjects<T>
public bool Insert(T obj)
{
for (int i = 0; i < _collection.Length; i++)
int index = Array.IndexOf(_collection, null);
if(index >= 0)
{
if (_collection[i] == null) {
_collection[i] = obj;
return true;
}
_collection[index] = obj;
return true;
}
return false;
}