Java List Merge mapMergeAdd(Map> map, Map> mapToAdd)

Here you can find the source of mapMergeAdd(Map> map, Map> mapToAdd)

Description

map Merge Add

License

Open Source License

Declaration

public static <T, U> void mapMergeAdd(Map<T, List<U>> map, Map<T, List<U>> mapToAdd) 

Method Source Code


//package com.java2s;
import java.util.*;

public class Main {
    public static <T, U> void mapMergeAdd(Map<T, List<U>> map, Map<T, List<U>> mapToAdd) {
        for (Map.Entry<T, List<U>> e : mapToAdd.entrySet()) {
            if (!map.containsKey(e.getKey())) {
                map.put(e.getKey(), new ArrayList<U>());
            }//w w w  .j  a  va 2 s  . com
            map.get(e.getKey()).addAll(e.getValue());
        }
    }
}

Related

  1. doMerge(List list, String sep)
  2. getMergedLines(List strings)
  3. getMergedSpeakerList()
  4. getMergeindexes(List spans, List indexes)
  5. merge(final List> listOfLists)
  6. merge(final List list, final String seperator)
  7. merge(final List a, final List b)
  8. merge(final List aList, final List bList)