How to solve java lambda filter future collection?
I got a future collection, And I want to filter out the false result returned in the collection, but using lambda
You must have return statements in all execution paths:
future.stream().filter(i -> {
try {
return i.get().get("success").equals(Boolean.FALSE);
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
}
return false; // depending on what you wish to return in case of exception
}).findAny().get().get();