question: @ NotNull @ Contract ( pure = true ) public static String strip ( @ NotNull final String s , @ NotNull final CharFilter filter ) { final StringBuilder result = new StringBuilder ( s . length ( ) ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { char ch = s . charAt ( i ) ; if ( filter . accept ( ch ) ) { result . append ( ch ) ; } } return result . toString ( ) ; }
target:  Strip out all characters not accepted by given filter