public void addFilter(Filter filter){
  int size=filters.size();
  if (size == 0 || filter.type == FilterType.SHOW || filters.get(size - 1).type != FilterType.SHOW) {
    filters.add(filter);
  }
 else {
    for (int i=0; i < size; i++) {
      if (filters.get(i).type == FilterType.SHOW) {
        filters.add(i,filter);
        break;
      }
    }
  }
}

public void addFilter ( Filter filter ) { int size = filters . size ( ) ; if ( size == 0 || filter . type == FilterType . SHOW || filters . get ( size - 1 ) . type != FilterType . SHOW ) { filters . add ( filter ) ; } else { for ( int i = 0 ; i < size ; i ++ ) { if ( filters . get ( i ) . type == FilterType . SHOW ) { filters . add ( i , filter ) ; break ; } } } }
adds the given filter to the list of filters . maintains the invariant that all ' show ' filters are listed after other types of filters .
