public static < C extends Collection < E > , E > C search ( E [ ] array , Supplier < C > supplier , Predicate < E > predicate ) { final Function < Iterator < E > , C > consumer = new ConsumeIntoCollection <> ( supplier ) ; final FilteringIterator < E > filtered = new FilteringIterator < E > ( new ArrayIterator < E > ( array ) , predicate ) ; return consumer . apply ( filtered ) ; }
Searches the array adding every value matching the predicate to the collection yielded by the passed supplier .