List of usage examples for java.util.stream IntStream findFirst
OptionalInt findFirst();
From source file:Main.java
public static void main(String[] args) { IntStream i = IntStream.of(1, 2, 3, 4); OptionalInt n = i.findFirst(); if (n.isPresent()) { System.out.println(n.getAsInt()); } else {/*from ww w . jav a 2 s .co m*/ System.out.println("noValue"); } }