public void addQueryToHistory(String sql){
  queryHistory.remove(sql);
  queryHistory.addFirst(sql);
  while (historySize >= 0 && queryHistory.size() > historySize) {
    queryHistory.removeLast();
  }
}

public void addQueryToHistory ( String sql ) { queryHistory . remove ( sql ) ; queryHistory . addFirst ( sql ) ; while ( historySize >= 0 && queryHistory . size ( ) > historySize ) { queryHistory . removeLast ( ) ; } }
adds the query to history .
