Map<String,String> addPresetsToTags(PresetItem preset,LinkedHashMap<String,String> tags){
  LinkedHashMap<String,String> leftOvers=new LinkedHashMap<String,String>();
  if (preset != null) {
    List<PresetItem> linkedPresetList=preset.getLinkedPresets();
    for (    String key : tags.keySet()) {
      if (preset.hasKeyValue(key,tags.get(key))) {
        storePreset(key,preset);
      }
 else {
        boolean found=false;
        if (linkedPresetList != null) {
          for (          PresetItem linkedPreset : linkedPresetList) {
            if (linkedPreset.hasKeyValue(key,tags.get(key))) {
              storePreset(key,linkedPreset);
              found=true;
              break;
            }
          }
        }
        if (!found) {
          leftOvers.put(key,tags.get(key));
        }
      }
    }
  }
 else {
    Log.e(DEBUG_TAG,"addPresetsToTags called with null preset");
  }
  return leftOvers;
}

Map < String , String > addPresetsToTags ( PresetItem preset , LinkedHashMap < String , String > tags ) { LinkedHashMap < String , String > leftOvers = new LinkedHashMap < String , String > ( ) ; if ( preset != null ) { List < PresetItem > linkedPresetList = preset . getLinkedPresets ( ) ; for ( String key : tags . keySet ( ) ) { if ( preset . hasKeyValue ( key , tags . get ( key ) ) ) { storePreset ( key , preset ) ; } else { boolean found = false ; if ( linkedPresetList != null ) { for ( PresetItem linkedPreset : linkedPresetList ) { if ( linkedPreset . hasKeyValue ( key , tags . get ( key ) ) ) { storePreset ( key , linkedPreset ) ; found = true ; break ; } } } if ( ! found ) { leftOvers . put ( key , tags . get ( key ) ) ; } } } } else { Log . e ( DEBUG_TAG , "addPresetsToTags called with null preset" ) ; } return leftOvers ; }
don ' t call with null preset
