From 14058c16030d77e65adc844b79e0008493c5451a Mon Sep 17 00:00:00 2001 From: Wouter Born Date: Tue, 8 Feb 2022 21:27:17 +0100 Subject: [PATCH] [insteon] Prevent null values from being inferred when printing to console (#12243) This prevents the null analysis from inferring null values when printing to a Console. Related to openhab/openhab-core#2742 Signed-off-by: Wouter Born --- .../internal/handler/InsteonNetworkHandler.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/bundles/org.openhab.binding.insteon/src/main/java/org/openhab/binding/insteon/internal/handler/InsteonNetworkHandler.java b/bundles/org.openhab.binding.insteon/src/main/java/org/openhab/binding/insteon/internal/handler/InsteonNetworkHandler.java index 69ce722ea8e99..c803e88d82b1e 100644 --- a/bundles/org.openhab.binding.insteon/src/main/java/org/openhab/binding/insteon/internal/handler/InsteonNetworkHandler.java +++ b/bundles/org.openhab.binding.insteon/src/main/java/org/openhab/binding/insteon/internal/handler/InsteonNetworkHandler.java @@ -12,10 +12,9 @@ */ package org.openhab.binding.insteon.internal.handler; -import java.util.ArrayList; -import java.util.Collections; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; @@ -244,10 +243,9 @@ public void unlinked(ChannelUID uid) { } private void display(Console console, Map info) { - ArrayList ids = new ArrayList<>(info.keySet()); - Collections.sort(ids); - for (String id : ids) { - console.println(info.get(id)); - } + info.entrySet().stream() // + .sorted(Entry.comparingByKey()) // + .map(Entry::getValue) // + .forEach(console::println); } }