public void addURL(final String url){
  while (currentIndex < history.size() - 1) {
    history.remove(currentIndex + 1);
  }
  history.add(url);
  currentIndex=history.size() - 1;
}

public void addURL ( final String url ) { while ( currentIndex < history . size ( ) - 1 ) { history . remove ( currentIndex + 1 ) ; } history . add ( url ) ; currentIndex = history . size ( ) - 1 ; }
add a new url to the browsing history . adding a new url causes all items beyond the current position to be eliminated from the history . the newly added url will be at the end of the browser history upon return .
