I have a list of integers and I need to find the sum of its items. If the list contains any null items, the result should be null. My current implementation:
intList.stream().anyMatch(Objects::isNull) ? null : intList.stream().mapToInt(Integer::intValue).sum();
Can this be done with a single continuous stream? Is there an operation that terminates the stream if an item meets a condition?