From 73ec188067b771a90c3209783dfd8f125c2baf32 Mon Sep 17 00:00:00 2001 From: Andrew Fiddian-Green Date: Wed, 29 Nov 2023 21:36:44 +0000 Subject: [PATCH] [hue] eliminate scenes having the same name (#15976) Signed-off-by: Andrew Fiddian-Green --- .../binding/hue/internal/handler/Clip2ThingHandler.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bundles/org.openhab.binding.hue/src/main/java/org/openhab/binding/hue/internal/handler/Clip2ThingHandler.java b/bundles/org.openhab.binding.hue/src/main/java/org/openhab/binding/hue/internal/handler/Clip2ThingHandler.java index 292416ec94f..95ecbcd1392 100644 --- a/bundles/org.openhab.binding.hue/src/main/java/org/openhab/binding/hue/internal/handler/Clip2ThingHandler.java +++ b/bundles/org.openhab.binding.hue/src/main/java/org/openhab/binding/hue/internal/handler/Clip2ThingHandler.java @@ -19,12 +19,14 @@ import java.time.Duration; import java.time.Instant; import java.util.ArrayList; import java.util.Collection; +import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Set; +import java.util.TreeSet; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.Future; @@ -1200,8 +1202,8 @@ public class Clip2ThingHandler extends BaseThingHandler { sceneResourceEntries.clear(); ResourceReference thisReference = getResourceReference(); - List scenes = allScenes.stream().filter(s -> thisReference.equals(s.getGroup())) - .collect(Collectors.toList()); + Set scenes = allScenes.stream().filter(s -> thisReference.equals(s.getGroup())) + .collect(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(Resource::getName)))); if (!scenes.isEmpty()) { sceneContributorsCache.putAll(scenes.stream().collect(Collectors.toMap(s -> s.getId(), s -> s)));