code: 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;
    }
docs: Utility function to see if the stack contains the given URL.
  
  @param stack non-null reference to a Stack.
  @param url URL string on which an equality test will be performed.
  
  @return true if the stack contains the url argument.