List<String> strings = ...
int sumOfLengths = strings.stream()
.map(String::length)
.reduce(0, Integer::plus);
int sum = shapes.stream()
.filter(s -> s.getColor() == BLUE)
.map(s -> s.getWeight())
.sum();