refactor: final var

This commit is contained in:
ineanto 2023-12-22 14:17:21 +01:00
parent 83bc00aebe
commit 153d666b78
2 changed files with 7 additions and 4 deletions

View file

@ -24,13 +24,13 @@ public class RandomNameFetcher {
try (BufferedReader reader = new BufferedReader(new InputStreamReader(resource))) {
String line;
while ((line = reader.readLine()) != null) {
String[] values = line.split("\n");
final String[] values = line.split("\n");
records.add(Arrays.asList(values));
}
} catch (IOException e) {
throw new RuntimeException(e);
}
return records.get(new Random().nextInt(records.size() -1)).get(0);
return records.get(new Random().nextInt(records.size() - 1)).get(0);
}
}