private void trimHistory(){
  while (mmHistory.size() > mmMaxHistorySize) {
    mmHistory.removeFirst();
    mmPosition--;
  }
  if (mmPosition < 0) {
    mmPosition=0;
  }
}

private void trimHistory ( ) { while ( mmHistory . size ( ) > mmMaxHistorySize ) { mmHistory . removeFirst ( ) ; mmPosition -- ; } if ( mmPosition < 0 ) { mmPosition = 0 ; } }
trim history when it exceeds max history size .
