diff --git a/WarmlyLocomotive/WarmlyLocomotive/SetLocomotivesGeneric.cs b/WarmlyLocomotive/WarmlyLocomotive/SetLocomotivesGeneric.cs index b8c7371..28765de 100644 --- a/WarmlyLocomotive/WarmlyLocomotive/SetLocomotivesGeneric.cs +++ b/WarmlyLocomotive/WarmlyLocomotive/SetLocomotivesGeneric.cs @@ -34,12 +34,7 @@ namespace WarmlyLocomotive /// public int Insert(T locomotive) { - if (_maxCount == Count) - { - return -1; - } - _places.Insert(0, locomotive); - return 0; + return Insert(locomotive, 0); } /// /// Добавление объекта в набор на конкретную позицию @@ -49,7 +44,7 @@ namespace WarmlyLocomotive /// public int Insert(T locomotive, int position) { - if (position < 0 || position >= Count || _maxCount == Count) + if (position < 0 || position > Count || _maxCount == Count) { return -1; }