Сделал очищение, а не создание новой коллекции

This commit is contained in:
Егор Пыжов 2024-05-07 14:28:19 +04:00
parent 239f4bdec8
commit f2b0279b17

View File

@ -186,16 +186,22 @@ public class StorageCollection<T extends DrawningBoat> {
String s = fs.readLine(); String s = fs.readLine();
if (s == null || !s.startsWith(_collectionSingleKey)) if (s == null || !s.startsWith(_collectionSingleKey))
return false; return false;
if (keys.contains(s)) { ICollectionGenericObjects<DrawningBoat> collection;
_storages.get(s).ClearCollection();
}
s = fs.readLine(); s = fs.readLine();
String[] record = s.split(_separatorForKeyValue); String[] record = s.split(_separatorForKeyValue);
if (record.length != 4) { if (record.length != 4) {
return false; return false;
} }
CollectionType collectionType = Enum.valueOf(CollectionType.class, record[1]);
ICollectionGenericObjects<DrawningBoat> collection = CreateCollection(collectionType); if (keys.contains(s)) {
_storages.get(s).ClearCollection();
collection = (ICollectionGenericObjects<DrawningBoat>) _storages.get(s);
}
else {
CollectionType collectionType = Enum.valueOf(CollectionType.class, record[1]);
collection = CreateCollection(collectionType);
}
if (collection == null) if (collection == null)
{ {
return false; return false;