Map
inputString.map(x -> {
if (!StringUtils.isBlank(x)) {
return x;
} else {
return Optional.empty();
}
}).orElse(Optional.empty());
Filter
Java < 16
return thing.getAllSubEntities()
.stream()
.filter(e -> e.isDisabled())
.collect(Collectors.toList());
Java >= 16
return thing.getAllSubEntities()
.stream()
.filter(e -> e.isDisabled())
.tolist();