Q:

Is it required to use orElse(null) in Streams?

I used this code snippet to find the first item in the String List which contained 'o' character : 
List<String> words = Arrays.asList("hi", "hello", "bye", "goodbye");
String s1 = words.stream().filter(word -> word.contains("o")).findFirst().orElse(null);

So this finds the first item that has 'o' (hello) and if it doesn't find anything it will return null as specified by orElse(null). So my question is :
Is it really necessary to use orElse(null) and if I don't specify it what will it return as default if it doesn't find any matches?

A:

findFirst returns an Optional. You need to use one of the orElse methods to get an actual value from it.

