Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 73ec188

Browse files
authoredNov 29, 2023
[hue] eliminate scenes having the same name (openhab#15976)
Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
1 parent b80273a commit 73ec188

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed
 

‎bundles/org.openhab.binding.hue/src/main/java/org/openhab/binding/hue/internal/handler/Clip2ThingHandler.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@
1919
import java.time.Instant;
2020
import java.util.ArrayList;
2121
import java.util.Collection;
22+
import java.util.Comparator;
2223
import java.util.HashMap;
2324
import java.util.HashSet;
2425
import java.util.List;
2526
import java.util.Map;
2627
import java.util.Objects;
2728
import java.util.Set;
29+
import java.util.TreeSet;
2830
import java.util.concurrent.ConcurrentHashMap;
2931
import java.util.concurrent.CopyOnWriteArrayList;
3032
import java.util.concurrent.Future;
@@ -1200,8 +1202,8 @@ public synchronized boolean updateSceneContributors(List<Resource> allScenes) {
12001202
sceneResourceEntries.clear();
12011203

12021204
ResourceReference thisReference = getResourceReference();
1203-
List<Resource> scenes = allScenes.stream().filter(s -> thisReference.equals(s.getGroup()))
1204-
.collect(Collectors.toList());
1205+
Set<Resource> scenes = allScenes.stream().filter(s -> thisReference.equals(s.getGroup()))
1206+
.collect(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(Resource::getName))));
12051207

12061208
if (!scenes.isEmpty()) {
12071209
sceneContributorsCache.putAll(scenes.stream().collect(Collectors.toMap(s -> s.getId(), s -> s)));

0 commit comments

Comments
 (0)
Please sign in to comment.