Java 8 Stream return property or null

Viewed 1760

Is there a way using streams to return the property of a bean or null if the bean isn't present?

Something like:

String property = beans.stream()
    .filter(bean -> bean.getId() == id).findFirst().orElse(null).beanProperty();
1 Answers
Related