private boolean stackContains(Stack stack,String url){
  int n=stack.size();
  boolean contains=false;
  for (int i=0; i < n; i++) {
    String url2=(String)stack.elementAt(i);
    if (url2.equals(url)) {
      contains=true;
      break;
    }
  }
  return contains;
}

private boolean stackContains ( Stack stack , String url ) { int n = stack . size ( ) ; boolean contains = false ; for ( int i = 0 ; i < n ; i ++ ) { String url2 = ( String ) stack . elementAt ( i ) ; if ( url2 . equals ( url ) ) { contains = true ; break ; } } return contains ; }
utility function to see if the stack contains the given url .
