Close resources

This commit is contained in:
filoghost 2020-06-26 11:41:44 +02:00
parent 022040c81f
commit a8be658769

View File

@ -22,6 +22,7 @@ import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.stream.Stream;
public class UpgradesDoneRegistry { public class UpgradesDoneRegistry {
@ -34,9 +35,10 @@ public class UpgradesDoneRegistry {
this.upgradesDone = new HashSet<>(); this.upgradesDone = new HashSet<>();
if (Files.isRegularFile(saveFile)) { if (Files.isRegularFile(saveFile)) {
Files.lines(saveFile, StandardCharsets.UTF_8) try (Stream<String> lines = Files.lines(saveFile, StandardCharsets.UTF_8)) {
.filter(s -> !s.startsWith("#")) lines.filter(s -> !s.startsWith("#"))
.forEach(upgradesDone::add); .forEach(upgradesDone::add);
}
} }
} }