public static < E > List < E > search ( Iterator < E > iterator , Predicate < E > predicate ) { final Function < Iterator < E > , ArrayList < E > > consumer = new ConsumeIntoCollection <> ( new ArrayListFactory < E > ( ) ) ; final FilteringIterator < E > filtered = new FilteringIterator < E > ( iterator , predicate ) ; return consumer . apply ( filtered ) ; }
Searches the iterator consuming it yielding every value matching the predicate .