code: public SubMenuItem findParent(MenuItem toFind) {
          synchronized (subMenuItems) {
              SubMenuItem parent = MenuTree.ROOT;
              for (Map.Entry<MenuItem, ArrayList<MenuItem>> entry : subMenuItems.entrySet()) {
                  for (MenuItem item : entry.getValue()) {
                      if (item.getId() == toFind.getId()) {
                          parent = asSubMenu(entry.getKey());
                      }
                  }
              }
              return parent;
          }
      }
docs: Finds the submenu that the provided object belongs to.
  @param toFind the object to find sub menu for.
  @return the submenu