code: public void addMenuItem(SubMenuItem parent, MenuItem item) {
          SubMenuItem subMenu = (parent != null) ? parent : ROOT;
  
          synchronized (subMenuItems) {
              ArrayList<MenuItem> subMenuChildren = subMenuItems.computeIfAbsent(subMenu, sm -> new ArrayList<>());
              subMenuChildren.add(item);
  
              if (item.hasChildren()) {
                  subMenuItems.put(item, new ArrayList<>());
              }
          }
      }
docs: add a new menu item to a sub menu, for the top level menu use ROOT.
  @param parent the submenu where this should appear
  @param item the item to be added