import java.util.AbstractCollection; import java.util.ArrayList; import java.util.HashMap; public class MapsCollection { private final HashMap> _mapStorages; public ArrayList Keys() { return new ArrayList<>(_mapStorages.keySet()); } private final int _pictureWidth; private final int _pictureHeight; public MapsCollection(int pictureWidth,int pictureHeight) { _mapStorages = new HashMap<>(); this._pictureWidth = pictureWidth; this._pictureHeight = pictureHeight; } public void AddMap(String Name, AbstractMap Map) { if(!_mapStorages.containsKey(Name)) { _mapStorages.put(Name,new MapWithSetShipGeneric<>(_pictureWidth,_pictureHeight,Map)); } } public void DelMap(String name) { _mapStorages.remove(name); } public MapWithSetShipGeneric Get(String ind) { if(_mapStorages.containsKey(ind)) { return _mapStorages.get(ind); } return null; } public DrawningObjectShip Get(String name, int ind) { if (_mapStorages.containsKey(name)) return _mapStorages.get(name).GetSelectedShip(ind); return null; } }