I face the same problem often. I need to count the runs of a lambda for use outside the lambda.
E.g.:
myStream.stream().filter(...).forEa
reduce also works,you can use it like this
myStream.stream().filter(...).reduce((item, sum) -> sum += item);