Pibd-14 SkobelevN.N. LabWork03 Base #3

Open
nikskob wants to merge 10 commits from LabWork03 into LabWork02
Showing only changes of commit 20fa07507f - Show all commits

View File

@ -26,7 +26,6 @@ public class MassiveGenericObjects<T> : ICollectionGenericObjects<T> where T : c
}
public T? Get(int position)
{
//todo
if (position >= 0 && position < Count)
{
return _collection[position];
@ -36,7 +35,6 @@ public class MassiveGenericObjects<T> : ICollectionGenericObjects<T> where T : c
}
public int Insert(T obj)
{
//todo
for (int i = 0; i < Count; i++)
{
if (_collection[i] == null)
@ -49,13 +47,11 @@ public class MassiveGenericObjects<T> : ICollectionGenericObjects<T> where T : c
return -1;
}
public int Insert(T obj, int position)
{
//todo
{
if (!(position > 0 && position < _collection.Length))
{
return -1;
}
if (_collection[position] == null)
_collection[position] = obj;
else
@ -68,7 +64,6 @@ public class MassiveGenericObjects<T> : ICollectionGenericObjects<T> where T : c
return i;
}
}
for (int i = position - 1; i >= 0; i--)
{
if (_collection[i] == null)
@ -86,7 +81,6 @@ public class MassiveGenericObjects<T> : ICollectionGenericObjects<T> where T : c
{
return null;
}
T? deletedElement = _collection[position];
_collection[position] = null;
return deletedElement;