Java Map Merge mergeNsPrefixes(final Map prioritaryPrefixes, final Map additionalPrefixes)

Here you can find the source of mergeNsPrefixes(final Map prioritaryPrefixes, final Map additionalPrefixes)

Description

Creates a new Map object containing all prefixes from both specified maps.

License

Apache License

Parameter

Parameter Description
prioritaryPrefixes a parameter
additionalPrefixes a parameter

Declaration

public static Map<String, String> mergeNsPrefixes(final Map<String, String> prioritaryPrefixes,
        final Map<String, String> additionalPrefixes) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.*;

public class Main {
    /**/*from   ww  w.  j a v  a2  s .  co m*/
     * Creates a new Map object containing all prefixes from both specified maps. When prefix mappings clash, the mappings
     * from prioritaryPrefixes are used.
     * @param prioritaryPrefixes
     * @param additionalPrefixes
     * @return
     */
    public static Map<String, String> mergeNsPrefixes(final Map<String, String> prioritaryPrefixes,
            final Map<String, String> additionalPrefixes) {
        Map<String, String> mergedPrefixes = new HashMap<String, String>();
        mergedPrefixes.putAll(additionalPrefixes);
        mergedPrefixes.putAll(prioritaryPrefixes); //overwrites the additional prefixes when clashing
        return mergedPrefixes;
    }
}

Related

  1. mergeMaps(Map destination, Map source)
  2. mergeMaps(Map map1, Map map2)
  3. mergeMapsIgnoreDuplicateKeys( Map first, Map second)
  4. mergeMapWithAdd(Map target, Map source)
  5. mergeNestableMap(Map original, Map additional)
  6. mergeOptions(Map> ssio, Map> allOptions)
  7. mergePermMap(Map> permMap, Map> subPermMap)
  8. mergePropertiesToMap(Properties properties, Map map, boolean overwrite)
  9. mergeResourceBundle(final Map map, final String path)