diff --git a/li.strolch.agent/src/main/java/li/strolch/search/StrolchSearch.java b/li.strolch.agent/src/main/java/li/strolch/search/StrolchSearch.java index ae5ff0131..151cf9fed 100644 --- a/li.strolch.agent/src/main/java/li/strolch/search/StrolchSearch.java +++ b/li.strolch.agent/src/main/java/li/strolch/search/StrolchSearch.java @@ -1,5 +1,6 @@ package li.strolch.search; +import java.util.List; import java.util.stream.Stream; import li.strolch.exception.StrolchAccessDeniedException; @@ -105,6 +106,42 @@ public abstract class StrolchSearch return new RootElementSearchResult<>(stream); } + /** + * Performs the actual search on the given input list + * + * @return the search result + */ + public RootElementSearchResult search(List input) { + + // first prepare + define(); + + Stream stream = input.stream(); + + if (this.expression != null) + stream = stream.filter(e -> this.expression.matches(e)); + + return new RootElementSearchResult<>(stream); + } + + /** + * Performs the actual search on the given input stream + * + * @return the search result + */ + public RootElementSearchResult search(Stream input) { + + // first prepare + define(); + + Stream stream = input; + + if (this.expression != null) + stream = stream.filter(e -> this.expression.matches(e)); + + return new RootElementSearchResult<>(stream); + } + /** * @see li.strolch.privilege.model.Restrictable#getPrivilegeName() */