diff --git a/bundles/org.openhab.binding.airparif/src/main/java/org/openhab/binding/airparif/internal/api/AirParifDto.java b/bundles/org.openhab.binding.airparif/src/main/java/org/openhab/binding/airparif/internal/api/AirParifDto.java index a68ff1a1604..0dd508a2988 100644 --- a/bundles/org.openhab.binding.airparif/src/main/java/org/openhab/binding/airparif/internal/api/AirParifDto.java +++ b/bundles/org.openhab.binding.airparif/src/main/java/org/openhab/binding/airparif/internal/api/AirParifDto.java @@ -115,7 +115,6 @@ public class AirParifDto { private static ZoneId DEFAULT_ZONE = ZoneId.of("Europe/Paris"); public List data = List.of(); - private @Nullable Set validities; private @Nullable ZonedDateTime beginValidity; private @Nullable ZonedDateTime endValidity; @@ -124,21 +123,15 @@ public class AirParifDto { } private Set getValidities() { - final Set local; - if (validities != null) { - local = validities; - } else { - local = new TreeSet(); - getData().ifPresent(pollens -> { - Matcher matcher = PATTERN.matcher(pollens.periode); - while (matcher.find()) { - local.add(LocalDate.parse(matcher.group(), FORMATTER).atStartOfDay(DEFAULT_ZONE)); - } - }); - validities = local; - } + Set validities = new TreeSet<>(); + getData().ifPresent(pollens -> { + Matcher matcher = PATTERN.matcher(pollens.periode); + while (matcher.find()) { + validities.add(LocalDate.parse(matcher.group(), FORMATTER).atStartOfDay(DEFAULT_ZONE)); + } + }); - return local; + return validities; } public Optional getBeginValidity() {