code: public void moveItem(SubMenuItem parent, MenuItem newItem, MoveType moveType) {
          synchronized (subMenuItems) {
              ArrayList<MenuItem> items = subMenuItems.get(parent);
              int idx = items.indexOf(newItem);
              if(idx < 0) return;
  
              items.remove(idx);
  
              idx = (moveType == MoveType.MOVE_UP)? --idx : ++idx;
              if(idx<0) idx=0;
  
              if(idx>=items.size()) {
                  items.add(newItem);
              }
              else {
                  items.add(idx, newItem);
              }
          }
      }
docs: Moves the item either up or down in the list for that submenu
  @param parent the parent id
  @param newItem the item to move
  @param moveType  the direction of the move.