您可以
flatMap与涉及
Stream的串联和三元运算符混合使用,例如:
List<SimpleProperty> result = top.getSuperComplexProperties().stream() .flatMap(scp -> Stream.concat( scp.getSimpleProperties().stream(), scp.getComplexProperty() == null ? Stream.empty() : scp.getComplexProperty().getSimpleProperties().stream())) .collect(Collectors.toList());



