public static < T > List < T > filter ( Collection < T > c , Filter < T > filter ) { if ( c . size ( ) == 0 ) return Collections . emptyList ( ) ; List < T > filteredList = new ArrayList < T > ( c . size ( ) ) ; for ( T element : c ) { if ( filter . select ( element ) ) filteredList . add ( element ) ; } return filteredList ; }
Returns List with elements from given collections which are selected by specified filter