Simplify map-building logic
This commit is contained in:
parent
e333cbd94d
commit
c6bb649adb
|
@ -44,9 +44,7 @@ public class AuthEnablementRefreshRequirementProvider implements WebsocketRefres
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
Map<Long, Boolean> buildDevicesEnabledMap(final Account account) {
|
Map<Long, Boolean> buildDevicesEnabledMap(final Account account) {
|
||||||
return account.getDevices().stream()
|
return account.getDevices().stream().collect(Collectors.toMap(Device::getId, Device::isEnabled));
|
||||||
.collect(() -> new HashMap<>(account.getDevices().size()),
|
|
||||||
(map, device) -> map.put(device.getId(), device.isEnabled()), HashMap::putAll);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue