return Stream.of(assetTemplateIds,
taskTemplatesIds,
List.of(name)).flatMap(SimpleGrantedAuthority::new)
.collect(Collectors.toList());
var templatesIds = Stream.concat(
assetTemplateIds.stream(),
taskTemplatesIds.stream()
);
return Stream.concat(
templatesIds,
Stream.of(name)
).map(SimpleGrantedAuthority::new)
.collect(Collectors.toList());
var result = component.getChildComponents().stream()
.sorted(Comparator.comparingInt(TextComponent::getCountChildElements))
.collect(Collectors.toList());
component.getChildComponents().clear();
component.getChildComponents().addAll(result);
public void setChildComponents(List<TextComponent> childComponents) {
this.childComponents = childComponents;
}
class Example {
public static void main(String[] args) {
var licenses = List.of(
new License(1, true),
new License(2, false),
new License(3, true)
);
var licenseMap = licenses.stream()
.collect(Collectors.toMap(License::getId, License::isActive));
}
@Getter
@RequiredArgsConstructor
private static class License {
private final Integer id;
private final boolean isActive;
}
}