public static < V , C extends Collection < Node < V > > > C collectNodes ( List < Node < V > > parents , Predicate < Node < V > > predicate , C collection ) { checkArgNotNull ( predicate , "predicate" ) ; checkArgNotNull ( collection , "collection" ) ; if ( parents != null && ! parents . isEmpty ( ) ) { for ( Node < V > child : parents ) { if ( predicate . apply ( child ) ) { collection . add ( child ) ; } collectNodes ( child , predicate , collection ) ; } } return collection ; }
Collects all nodes underneath the given parents for which the given predicate evaluates to true .