From a180fa3b0a4eee89d8c6970689d6b6be22e26c94 Mon Sep 17 00:00:00 2001 From: BoiledMilk123 Date: Wed, 5 Jun 2024 01:35:49 +0400 Subject: [PATCH] labwork04 UP! --- .../src/CollectionGenericObjects/StorageCollection.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ProjectElectricLocomotive/src/CollectionGenericObjects/StorageCollection.java b/ProjectElectricLocomotive/src/CollectionGenericObjects/StorageCollection.java index 573febc..4495ae4 100644 --- a/ProjectElectricLocomotive/src/CollectionGenericObjects/StorageCollection.java +++ b/ProjectElectricLocomotive/src/CollectionGenericObjects/StorageCollection.java @@ -27,7 +27,13 @@ public class StorageCollection { } } + public T GetShip(String name, int ind){ + if (name == null || !storage.containsKey(name)) return null; + return storage.get(name).get(ind); + } + public void delCollection(String name) { + if(!storage.containsKey(name)) return; storage.remove(name); }