Skip to content

Commit

Permalink
Remove resource passed as an argument from try-with-resources (#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
pepe2405 authored Jan 11, 2024
1 parent 9a9faca commit 273d7f1
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,8 @@ public class PeakExplorer {
private final List<Peak> peaks;

public PeakExplorer(Reader dataInput) {
try (var reader = new BufferedReader(dataInput)) {
peaks = reader.lines().map(Peak::of).toList();
} catch (IOException e) {
throw new UncheckedIOException("A problem occurred while reading from the file", e);
}
var reader = new BufferedReader(dataInput);
peaks = reader.lines().map(Peak::of).toList();
}

private static void optionalUsageExample(Optional<String> optionalPeakName) {
Expand Down

0 comments on commit 273d7f1

Please sign in to comment.