I have this piece of code, where I want to return an element if present, otherwise null
List<String> myList = new ArrayList<>();
myList.add("Test");
myList.add("Example");
myList.add("Sth");
String str = myList.stream()
.filter(x -> x.equals("eee"))
.findFirst()
.orElseGet(null);
but I got an Exception in thread "main" java.lang.NullPointerException anyway