[hue] eliminate scenes having the same name (#15976)
Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
This commit is contained in:
parent
b80273a88a
commit
73ec188067
|
@ -19,12 +19,14 @@ import java.time.Duration;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.TreeSet;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
|
@ -1200,8 +1202,8 @@ public class Clip2ThingHandler extends BaseThingHandler {
|
||||||
sceneResourceEntries.clear();
|
sceneResourceEntries.clear();
|
||||||
|
|
||||||
ResourceReference thisReference = getResourceReference();
|
ResourceReference thisReference = getResourceReference();
|
||||||
List<Resource> scenes = allScenes.stream().filter(s -> thisReference.equals(s.getGroup()))
|
Set<Resource> scenes = allScenes.stream().filter(s -> thisReference.equals(s.getGroup()))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(Resource::getName))));
|
||||||
|
|
||||||
if (!scenes.isEmpty()) {
|
if (!scenes.isEmpty()) {
|
||||||
sceneContributorsCache.putAll(scenes.stream().collect(Collectors.toMap(s -> s.getId(), s -> s)));
|
sceneContributorsCache.putAll(scenes.stream().collect(Collectors.toMap(s -> s.getId(), s -> s)));
|
||||||
|
|
Loading…
Reference in New Issue