типы поправил
This commit is contained in:
parent
40042fbcef
commit
9d782d7465
@ -50,21 +50,21 @@ public class MassiveGenericObjects<T> : ICollectionGenericObjects<T>
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Insert(T obj)
|
public int Insert(T obj)
|
||||||
{
|
{
|
||||||
return Insert(obj, 0);
|
return Insert(obj, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Insert(T obj, int position)
|
public int Insert(T obj, int position)
|
||||||
{
|
{
|
||||||
if (position < 0 || position >= Count)
|
if (position < 0 || position >= Count)
|
||||||
{
|
{
|
||||||
return false;
|
return -1;
|
||||||
}
|
}
|
||||||
if (_collection[position] == null)
|
if (_collection[position] == null)
|
||||||
{
|
{
|
||||||
_collection[position] = obj;
|
_collection[position] = obj;
|
||||||
return true;
|
return position;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = position + 1; i < Count; i++)
|
for (int i = position + 1; i < Count; i++)
|
||||||
@ -72,7 +72,7 @@ public class MassiveGenericObjects<T> : ICollectionGenericObjects<T>
|
|||||||
if (_collection[i] == null)
|
if (_collection[i] == null)
|
||||||
{
|
{
|
||||||
_collection[i] = obj;
|
_collection[i] = obj;
|
||||||
return true;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = position - 1; i >= 0; i--)
|
for (int i = position - 1; i >= 0; i--)
|
||||||
@ -80,21 +80,21 @@ public class MassiveGenericObjects<T> : ICollectionGenericObjects<T>
|
|||||||
if (_collection[i] == null)
|
if (_collection[i] == null)
|
||||||
{
|
{
|
||||||
_collection[i] = obj;
|
_collection[i] = obj;
|
||||||
return true;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Remove(int position)
|
public T Remove(int position)
|
||||||
{
|
{
|
||||||
if (position < 0 || position >= Count)
|
if (position < 0 || position >= Count)
|
||||||
{
|
{
|
||||||
return false;
|
return null;
|
||||||
}
|
}
|
||||||
T obj = _collection[position];
|
T obj = _collection[position];
|
||||||
_collection[position] = null;
|
_collection[position] = null;
|
||||||
return true;
|
return obj;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user