我正在尝试使用Stream过滤2个条件:
private List filterResources(final List resources, final String resourceType, final String propertyName) {
List result = resources.stream()
.filter(resource -> resource.isResourceType(resourceType))
.map(Resource::getValueMap)
.map(valueMap -> valueMap.get(propertyName, StringUtils.EMPTY))
.collect(Collectors.toList());
return result.stream().filter(s -> !s.isEmpty()).collect(Collectors.toList());
我希望不提前创建结果对象.