Imagine we have list of 3 objects with minutes field as values: 5,5,7, 8
int sumOfFields = found.stream()
.filter(abc -> minutesLessThan5(abc.getMinutes())))
.mapToInt(abc::getMinutes)
.sum();
// will return 10
But how can I change my output e.g. instead of getMinutes I want to return my own value e.g. 40
int sumOfFields = found.stream()
.filter(abc -> minutesLessThan5(abc.getMinutes())))
.mapToInt(abc ->abc.getMinutes() = 40) //this is pseudo code what I try to achive
.sum();
// output should be 80.