Compare commits

..

2 commits

Author SHA1 Message Date
03c8067796
feat!: Release 1.0.0 2024-07-19 01:20:38 +02:00
03fad8ff96
fix: Map key comparison, preventing NPE 2024-07-19 01:11:03 +02:00
3 changed files with 5 additions and 3 deletions

View file

@ -14,7 +14,7 @@
<groupId>eu.ztsh</groupId>
<artifactId>large-file-reading-challenge</artifactId>
<name>Large File Reading Challenge</name>
<version>1.0.0-SNAPSHOT</version>
<version>1.0.0</version>
<properties>
<!-- encoding -->

View file

@ -30,7 +30,7 @@ public class TemperaturesServiceImpl implements TemperaturesService {
Thread.currentThread().interrupt();
}
}
return averages.get().get(city);
return averages.get().getOrDefault(city.toLowerCase(), List.of());
}
@EventListener(FileProcessedEvent.class)

View file

@ -79,7 +79,9 @@ public class FileLoadingService {
.map(line -> {
try {
var parts = line.split(";");
return new DataRow(parts[0], Integer.parseInt(parts[1].split("-")[0]), Double.parseDouble(parts[2]));
return new DataRow(parts[0].toLowerCase(),
Integer.parseInt(parts[1].split("-")[0]),
Double.parseDouble(parts[2]));
} catch (Exception e) {
throw new FileProcessingException("Error in line %s".formatted(line), e);
}