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

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();
if (s == null || !s.startsWith(_collectionSingleKey))
return false;
if (keys.contains(s)) {
_storages.get(s).ClearCollection();
}
ICollectionGenericObjects<DrawningBoat> collection;
s = fs.readLine();
String[] record = s.split(_separatorForKeyValue);
if (record.length != 4) {
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)
{
return false;