return StreamsUtils.joinAll(listOfFutures);
.joinAllStream(listOfFutures)
/** * Perform the computations sequentially at this point. */ private List<List<SearchResults>> computeSequentially() { // Return the list of lists of SearchResults. return mInputList // Convert the list of input strings into a stream. .stream() // Create a SearchForPhrasesTask that searches an input // string for a list of phrases and store the results from // computing the task. .map(input -> new SearchForPhrasesTask(input, mPhrasesToFind).compute()) // If a phrase was found add it to the list of results. .filter(not(List<SearchResults>::isEmpty)) // Trigger stream processing and collect the results into a // list. .collect(toList()); }
.filter(not(SearchResults::isEmpty))
return StreamsUtils.joinAll(listOfFutures);
.filter(not(SearchResults::isEmpty))
.filter(not(SearchResults::isEmpty))
.filter(not(SearchResults::isEmpty))
.filter(not(SearchResults::isEmpty))
.filter(not(SearchResults::isEmpty))
.filter(not(SearchResults::isEmpty))
.filter(not(SearchResults::isEmpty))
.filter(not(SearchResults::isEmpty))