public static Object[] mergeAndExtractParams(Map<String,? extends Object> globalConfig,Map<String,? extends Object> localParams,Collection<String> ignoreParams,Map<String,ExternalResourceDescription> resources){
  Set<String> uniqueParams=new HashSet<>();
  uniqueParams.addAll(localParams.keySet());
  uniqueParams.addAll(globalConfig.keySet());
  if (ignoreParams != null) {
    uniqueParams.removeAll(ignoreParams);
  }
  Object[] params=new Object[resources.size() * 2 + uniqueParams.size() * 2];
  int i=0;
  for (  Entry<String,ExternalResourceDescription> entry : resources.entrySet()) {
    params[i++]=entry.getKey();
    params[i++]=entry.getValue();
  }
  for (  String key : uniqueParams) {
    params[i++]=key;
    if (localParams.containsKey(key)) {
      params[i++]=CpeBuilderUtils.convertToParameterValue(localParams.get(key));
    }
 else {
      params[i++]=CpeBuilderUtils.convertToParameterValue(globalConfig.get(key));
    }
  }
  return params;
}

public static Object [ ] mergeAndExtractParams ( Map < String , ? extends Object > globalConfig , Map < String , ? extends Object > localParams , Collection < String > ignoreParams , Map < String , ExternalResourceDescription > resources ) { Set < String > uniqueParams = new HashSet < > ( ) ; uniqueParams . addAll ( localParams . keySet ( ) ) ; uniqueParams . addAll ( globalConfig . keySet ( ) ) ; if ( ignoreParams != null ) { uniqueParams . removeAll ( ignoreParams ) ; } Object [ ] params = new Object [ resources . size ( ) * 2 + uniqueParams . size ( ) * 2 ] ; int i = 0 ; for ( Entry < String , ExternalResourceDescription > entry : resources . entrySet ( ) ) { params [ i ++ ] = entry . getKey ( ) ; params [ i ++ ] = entry . getValue ( ) ; } for ( String key : uniqueParams ) { params [ i ++ ] = key ; if ( localParams . containsKey ( key ) ) { params [ i ++ ] = CpeBuilderUtils . convertToParameterValue ( localParams . get ( key ) ) ; } else { params [ i ++ ] = CpeBuilderUtils . convertToParameterValue ( globalConfig . get ( key ) ) ; } } return params ; }
merges local parameters and resources with global parameters , with local parameters taking precedence over global parameters where there is a conflict . keys that are on the ignoreparams list are ignored .
