question: private void addUpdateMenuItem ( ModelMenuItem modelMenuItem , List < ModelMenuItem > menuItemList , Map < String , ModelMenuItem > menuItemMap ) { ModelMenuItem existingMenuItem = menuItemMap . get ( modelMenuItem . getName ( ) ) ; if ( existingMenuItem != null ) { ModelMenuItem mergedMenuItem = existingMenuItem . mergeOverrideModelMenuItem ( modelMenuItem ) ; int existingItemIndex = menuItemList . indexOf ( existingMenuItem ) ; menuItemList . set ( existingItemIndex , mergedMenuItem ) ; menuItemMap . put ( modelMenuItem . getName ( ) , mergedMenuItem ) ; } else { menuItemList . add ( modelMenuItem ) ; menuItemMap . put ( modelMenuItem . getName ( ) , modelMenuItem ) ; } }
target:  add/override modelMenuItem using the menuItemList and menuItemMap