I am trying to stream a list of strings. I know we can do it like below:
list.stream().filter(i -> !Stringutils.isempty(service.someMethod(i))).map(i -> service.someMethod(i)).findfirst().get();
The problem is I need to call the service.someMethod
twice.
Any suggestions here to avoid the service.someMethod
calling it twice once in filter and another one for mapping?