public static < M extends MessageLiteOrBuilder > List < M > filter ( List < M > objs , Predicate < M > filter ) { checkNotNull ( filter ) ; for ( int i = 0 ; i < objs . size ( ) ; ++ i ) { if ( ! filter . test ( objs . get ( i ) ) ) { // At least one discarded object, go to slow-path. return filterFrom ( objs , filter , i ) ; } } // Optimized common case: all items filtered, return the input sequence. return objs ; }
Runs a filter through a sequence of objects .