import java.util.*; import java.util.stream.Collectors; public class CarsGenericStorage { final HashMap> _carStorages; public ArrayList Keys() { return new ArrayList<>(_carStorages.keySet()); } private final int _pictureWidth; private final int _pictureHeight; public CarsGenericStorage(int pictureWidth, int pictureHeight) { _pictureHeight = pictureHeight; _pictureWidth = pictureWidth; _carStorages = new HashMap<>(); } public void AddSet(String name) { if (Keys().contains(name)) return; _carStorages.put(name, new CarsGenericCollection<>(_pictureWidth, _pictureHeight)); } public void DelSet(String name) { if (!Keys().contains(name)) return; _carStorages.remove(name); } public CarsGenericCollection get(String ind) { if (Keys().contains(ind)) return _carStorages.get(ind); return null; } public DrawingObjectTanker get(String name, int ind) { if (!Keys().contains(name)) return null; return _carStorages.get(name).GetU(ind); } }