Skip to content

Commit

Permalink
Simplify thing type filtering.
Browse files Browse the repository at this point in the history
Signed-off-by: Jacob Laursen <[email protected]>
  • Loading branch information
jlaur committed Jan 16, 2022
1 parent eec26af commit df5b2d9
Showing 1 changed file with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -658,15 +658,14 @@ private void updateScheduledEventStates(List<ScheduledEvent> scheduledEvents) {

private Map<Thing, String> getShadeThingIdMap() {
Map<Thing, String> ret = new HashMap<>();
for (Thing thing : getThing().getThings()) {
if (!HDPowerViewBindingConstants.THING_TYPE_SHADE.equals(thing.getThingTypeUID())) {
continue;
}
String id = thing.getConfiguration().as(HDPowerViewShadeConfiguration.class).id;
if (id != null && !id.isEmpty()) {
ret.put(thing, id);
}
}
getThing().getThings().stream()
.filter(thing -> HDPowerViewBindingConstants.THING_TYPE_SHADE.equals(thing.getThingTypeUID()))
.forEach(thing -> {
String id = thing.getConfiguration().as(HDPowerViewShadeConfiguration.class).id;
if (id != null && !id.isEmpty()) {
ret.put(thing, id);
}
});
return ret;
}

Expand Down

0 comments on commit df5b2d9

Please sign in to comment.