public boolean add(String document,boolean toHead){
  int i=documents.indexOf(document);
  if (0 == i)   return false;
  if (0 < i) {
    documents.remove(i);
  }
 else {
    while (documents.size() >= maxSize) {
      documents.remove(maxSize - 1);
    }
  }
  if (toHead) {
    documents.add(0,document);
  }
 else {
    documents.add(document);
  }
  fireMRUListChanged();
  return true;
}

public boolean add ( String document , boolean toHead ) { int i = documents . indexOf ( document ) ; if ( 0 == i ) return false ; if ( 0 < i ) { documents . remove ( i ) ; } else { while ( documents . size ( ) >= maxSize ) { documents . remove ( maxSize - 1 ) ; } } if ( toHead ) { documents . add ( 0 , document ) ; } else { documents . add ( document ) ; } fireMRUListChanged ( ) ; return true ; }
adds a document at the top of the list of documents mru . if the list is already full , an old entry is removed , to make place for this new document .
