question: public static < A > List < A > filter ( List < A > l , A elem ) { Assert . checkNonNull ( elem ) ; List < A > res = List . nil ( ) ; for ( A a : l ) { if ( a != null && ! a . equals ( elem ) ) { res = res . prepend ( a ) ; } } return res . reverse ( ) ; }
target:  Returns the list obtained from 'l' after removing all elements 'elem'