изменена проверка ограничений массива

This commit is contained in:
tyxz0 2024-04-25 21:06:06 +04:00
parent eb48bafca8
commit 59d11e7b84

View File

@ -41,7 +41,7 @@ public class MassiveGenericObjects<T> : ICollectionGenericObjects<T>
public T? Get(int position) public T? Get(int position)
{ {
if (position < 0 || position > Count) if (position < 0 || position >= Count)
{ {
return null; return null;
} }
@ -57,7 +57,7 @@ public class MassiveGenericObjects<T> : ICollectionGenericObjects<T>
public int Insert(T obj, int position) public int Insert(T obj, int position)
{ {
if (position < 0 || position > Count) if (position < 0 || position >= Count)
{ {
return -1; return -1;
} }
@ -89,7 +89,7 @@ public class MassiveGenericObjects<T> : ICollectionGenericObjects<T>
public T? Remove(int position) public T? Remove(int position)
{ {
if (position < 0 || position > Count) if (position < 0 || position >= Count)
{ {
return null; return null;
} }