import java.util.ArrayList; public class SetAircraftsGeneric { private ArrayList _places; private int _maxCount; public int getCount() { return _places.size(); } public SetAircraftsGeneric(int count) { _places = new ArrayList<>(); _maxCount = count; } public int Insert(T aircraft) { if (_places.size() == _maxCount) return -1; _places.add(0, aircraft); return 0; } public int Insert(T aircraft, int position) { if (_places.size() == _maxCount) return -1; _places.add(position, aircraft); return position; } public T Remove(int position) { if(position > _maxCount || position < 0) return null; T res = _places.get(position); _places.remove(res); return res; } public T Get(int position) { return _places.get(position); } }