Java Map Merge mergePermMap(Map> permMap, Map> subPermMap)

Here you can find the source of mergePermMap(Map> permMap, Map> subPermMap)

Description

merge Perm Map

License

Apache License

Declaration

private static <T> void mergePermMap(Map<String, Set<T>> permMap, Map<String, Set<T>> subPermMap) 

Method Source Code

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

import java.util.Iterator;

import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

public class Main {

    private static <T> void mergePermMap(Map<String, Set<T>> permMap, Map<String, Set<T>> subPermMap) {
        Set<Entry<String, Set<T>>> subEntrySet = subPermMap.entrySet();
        Iterator<Entry<String, Set<T>>> subEntryIterator = subEntrySet.iterator();
        while (subEntryIterator.hasNext()) {
            Entry<String, Set<T>> subEntry = subEntryIterator.next();
            String permTypeName = subEntry.getKey();
            Set<T> permValueSet = subEntry.getValue();

            if (permMap.containsKey(permTypeName)) {
                permMap.get(permTypeName).addAll(permValueSet);
            } else {
                permMap.put(permTypeName, permValueSet);
            }//ww  w  .  j av  a  2s .  c  o m
        }
    }
}

Related

  1. mergeMapsIgnoreDuplicateKeys( Map first, Map second)
  2. mergeMapWithAdd(Map target, Map source)
  3. mergeNestableMap(Map original, Map additional)
  4. mergeNsPrefixes(final Map prioritaryPrefixes, final Map additionalPrefixes)
  5. mergeOptions(Map> ssio, Map> allOptions)
  6. mergePropertiesToMap(Properties properties, Map map, boolean overwrite)
  7. mergeResourceBundle(final Map map, final String path)
  8. mergeTemplate(String template, Map segments)
  9. mergeValue(Map obj, String key, Object value)