From 34bc112011296d6105b98b3f3ba7ad5d7e107104 Mon Sep 17 00:00:00 2001 From: Mark Herwege Date: Tue, 3 Dec 2024 08:33:59 +0100 Subject: [PATCH] review feedback Signed-off-by: Mark Herwege --- .../persistence/mapdb/internal/MapDbPersistenceService.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bundles/org.openhab.persistence.mapdb/src/main/java/org/openhab/persistence/mapdb/internal/MapDbPersistenceService.java b/bundles/org.openhab.persistence.mapdb/src/main/java/org/openhab/persistence/mapdb/internal/MapDbPersistenceService.java index 60b828aa4df..5aaab14b32e 100644 --- a/bundles/org.openhab.persistence.mapdb/src/main/java/org/openhab/persistence/mapdb/internal/MapDbPersistenceService.java +++ b/bundles/org.openhab.persistence.mapdb/src/main/java/org/openhab/persistence/mapdb/internal/MapDbPersistenceService.java @@ -36,10 +36,10 @@ import org.mapdb.DBMaker; import org.openhab.core.OpenHAB; import org.openhab.core.common.ThreadPoolManager; import org.openhab.core.items.Item; +import org.openhab.core.items.ManagedItemProvider.PersistedItem; import org.openhab.core.library.types.DateTimeType; import org.openhab.core.persistence.FilterCriteria; import org.openhab.core.persistence.HistoricItem; -import org.openhab.core.persistence.PersistedItem; import org.openhab.core.persistence.PersistenceItemInfo; import org.openhab.core.persistence.PersistenceService; import org.openhab.core.persistence.QueryablePersistenceService; @@ -165,7 +165,7 @@ public class MapDbPersistenceService implements QueryablePersistenceService { @Override public Set getItemInfo() { return map.values().stream().map(this::deserialize).flatMap(MapDbPersistenceService::streamOptional) - .collect(Collectors. toUnmodifiableSet()); + .collect(Collectors.toUnmodifiableSet()); } @Override @@ -217,7 +217,7 @@ public class MapDbPersistenceService implements QueryablePersistenceService { return null; } Optional item = deserialize(json); - return item.isPresent() ? item.get() : null; + return item.orElse(null); } private String serialize(MapDbItem item) {