Java - Stream Processing

> Procedural Languages > Java

1 - About

Advertising

3 - How to

3.1 - Return the first element

Integer i = IntStream.range(2,11).findFirst().orElse(null);

As findFirst is an optional, you use orElse instead of get because get will throw an exception if the value is null