public static < T > List < T > filtered ( Collection < T > data , Filter < T > filter ) { List < T > list = new ArrayList <> ( ) ; if ( ! Utils . isEmpty ( data ) ) { for ( T item : data ) { if ( filter . accept ( item ) ) { list . add ( item ) ; } } } return list ; }
Returns new List without items which not accepted by filter