if (path[i].equals (oldSelection))
if (path[i].equals(oldSelectedPath))
  public void setSelectedPath (MenuElement[] path)  {    if (path == null)      {        clearSelectedPath ();        return;      }    int i;    int minSize = path.length; // size of the smaller path.     if (path.length > selection.size ())      {        // if new selected path contains more elements then current        // selection then first add all elements at         // the indexes > selection.size 	        for (i = selection.size (); i < path.length; i++)          {            selection.add (path[i]);            path[i].menuSelectionChanged (true);          }        minSize = selection.size ();      }    else if (path.length < selection.size ())      {        // if new selected path contains less elements then current         // selection then first remove all elements from the selection        // at the indexes > path.length	        for (i = selection.size () - 1; i >= path.length; i--)          {            ((MenuElement) selection.get (i)).menuSelectionChanged (false);            selection.remove (i);          }        minSize = path.length;      }    // Now compare elements in new and current selection path at the     // same location and adjust selection until     // same menu elements will be encountered at the    // same index in both current and new selection path.        MenuElement oldSelection;    for (i = minSize - 1; i >= 0; i--)      {        oldSelection = (MenuElement) selection.get (i);        if (path[i].equals (oldSelection))          break;        oldSelection.menuSelectionChanged (false);        path[i].menuSelectionChanged (true);        selection.setElementAt (path[i], i);      }  }