How can I get the actual stream in order to filter or map methods from an Optional ? For instance
Optional.ofNullable(id)
.map(this:loadAllById) // method loadAllById return a stream (now is wrapped in Optional<Stream>)
.filter(obj -> obj.status) // here i have no access to object in stream but to the full stream
From this a doubt also arises. Is it correct to have a stream inside an Optional? Since the stream should always be not null (in case empty) shouldn't the check be needed?