List of usage examples for java.util.stream LongStream reduce
OptionalLong reduce(LongBinaryOperator op);
From source file:Main.java
public static void main(String[] args) { LongStream b = LongStream.of(1L, 2L, 3L, 4L); OptionalLong v = b.reduce(Long::sum); if (v.isPresent()) { System.out.println(v.getAsLong()); } else {/*from www . j av a2 s. c o m*/ System.out.println("no value"); } }