'Optional.get()' without 'isPresent()' check
Replace get()
with orElse(null)
.
...findFirst().orElse(null);
Returns the value if present, otherwise returns null
. The documentation says that the passed parameter may be null
(what is forbidden for orElseGet
and orElseThrow
).