Skip to content

Commit

Permalink
[insteon] Prevent null values from being inferred when printing to co…
Browse files Browse the repository at this point in the history
…nsole (openhab#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 <[email protected]>
Signed-off-by: Nick Waterton <[email protected]>
  • Loading branch information
wborn authored and NickWaterton committed Apr 27, 2022
1 parent 889279b commit b23cb2b
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -244,10 +243,9 @@ public void unlinked(ChannelUID uid) {
}

private void display(Console console, Map<String, String> info) {
ArrayList<String> 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);
}
}

0 comments on commit b23cb2b

Please sign in to comment.