I want to generate 4 random numbers, ranging from 1 through 6 inclusive. Then I want to get the sum of these elements excluding the smallest value.
I am currently creating one stream to populate a list:
List<Integer> values = r.ints(4,1,7).boxed().collect(Collectors.toList())
Then I remove the smallest value and use another stream to get the sum of the values:
values.stream().mapToInt(Integer::intValue).sum();
Can someone suggest a way to perform all these operations in a single stream?