private void applyFilter ( ) { filteredItems . clear ( ) ; Filter < M > filter = getFilter ( ) ; if ( filter == null ) { filteredItems . addAll ( items ) ; } else { for ( int i = 0 ; i < items . size ( ) ; i ++ ) { M item = items . get ( i ) ; if ( filter . filter ( item , query ) ) { filteredItems . add ( item ) ; } } } onFiltered ( ) ; }
Apply the filter if possible to the adapter to update content