We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b728ada commit 05227bdCopy full SHA for 05227bd
1 file changed
solution/day21/src/main/java/audit/Persister.java
@@ -8,10 +8,11 @@
8
9
public class Persister {
10
public FileContent[] readDirectory(String directory) throws IOException {
11
- return Files.walk(Paths.get(directory))
12
- .filter(Files::isRegularFile)
13
- .map(Persister::readFile)
14
- .toArray(FileContent[]::new);
+ try (var paths = Files.walk(Paths.get(directory))) {
+ return paths.filter(Files::isRegularFile)
+ .map(Persister::readFile)
+ .toArray(FileContent[]::new);
15
+ }
16
}
17
18
public void applyUpdate(String directory, FileUpdate update) throws IOException {
0 commit comments