code: public static MenuItem createFromExistingWithId(MenuItem selected, int newId) {
          return visitWithResult(selected, new AbstractMenuItemVisitor<MenuItem>() {
              @Override
              public void visit(AnalogMenuItem item) {
                  setResult(AnalogMenuItemBuilder.anAnalogMenuItemBuilder()
                          .withExisting(item)
                          .withId(newId)
                          .menuItem()
                  );
              }
  
              @Override
              public void visit(BooleanMenuItem item) {
                  setResult(BooleanMenuItemBuilder.aBooleanMenuItemBuilder()
                          .withExisting(item)
                          .withId(newId)
                          .menuItem()
                  );
              }
  
              @Override
              public void visit(EnumMenuItem item) {
                  setResult(EnumMenuItemBuilder.anEnumMenuItemBuilder()
                          .withExisting(item)
                          .withId(newId)
                          .menuItem()
                  );
              }
  
              @Override
              public void visit(SubMenuItem item) {
                  setResult(SubMenuItemBuilder.aSubMenuItemBuilder()
                          .withExisting(item)
                          .withId(newId)
                          .menuItem()
                  );
              }
  
              @Override
              public void visit(TextMenuItem item) {
                  setResult(TextMenuItemBuilder.aTextMenuItemBuilder()
                          .withExisting(item)
                          .withId(newId)
                          .menuItem()
                  );
              }
  
              @Override
              public void visit(RemoteMenuItem item) {
                  setResult(RemoteMenuItemBuilder.aRemoteMenuItemBuilder()
                          .withExisting(item)
                          .withId(newId)
                          .menuItem()
                  );
              }
  
              @Override
              public void visit(FloatMenuItem item) {
                  setResult(FloatMenuItemBuilder.aFloatMenuItemBuilder()
                          .withExisting(item)
                          .withId(newId)
                          .menuItem()
                  );
              }
              @Override
              public void visit(ActionMenuItem item) {
                  setResult(ActionMenuItemBuilder.anActionMenuItemBuilder()
                          .withExisting(item)
                          .withId(newId)
                          .menuItem()
                  );
              }
          }).orElse(null);
      }
docs: creates a copy of the menu item chosen, with the ID changed to newId
  @param selected the item to copy
  @param newId the ID for the copy
  @return the newly created item