Исправление метода вставки в классе SetPlaneGeneric

This commit is contained in:
Володя 2022-11-11 11:05:26 +03:00
parent 412fab79a2
commit 98421f8d63

View File

@ -20,17 +20,13 @@ namespace AirPlaneWithRadar
}
public int Insert(T plain)
{
if (_places.Count == _maxCount)
{
return -1;
}
_places.Insert(0, plain);
Insert(plain, 0);
return _places.Count;
}
public int Insert(T plain, int position)
{
if (position < 0 || _places.Count < position||position > _maxCount)
if (position < 0 || _places.Count < position||position > _maxCount || _places.Count == _maxCount)
return -1;
else if (plain == null)
return -1;