[New] Added ValueSearch.search(Stream)

This commit is contained in:
Robert von Burg 2019-03-05 17:59:17 +01:00
parent 68e06af486
commit 0b4e2e6e40
1 changed files with 8 additions and 2 deletions

View File

@ -21,9 +21,15 @@ public class ValueSearch<T> implements SearchPredicates {
* @return the search result * @return the search result
*/ */
public SearchResult<T> search(Collection<T> input) { public SearchResult<T> search(Collection<T> input) {
return search(input.stream());
}
Stream<T> stream = input.stream(); /**
* Performs the actual search on the given input list
*
* @return the search result
*/
public SearchResult<T> search(Stream<T> stream) {
if (this.expression != null) if (this.expression != null)
stream = stream.filter(e -> this.expression.matches(e)); stream = stream.filter(e -> this.expression.matches(e));