Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

12
LINES

< > BotCompany Repo | #1023858 // mergeMapsToMultiMap - merge maps into a multi map. uniquify values

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2086L/13K).

static <A, B> MultiMap<A, B> mergeMapsToMultiMap(Map<A, B>... maps) {
  ret mergeMapsToMultiMap(asList(maps));
}

static <A, B> MultiMap<A, B> mergeMapsToMultiMap(Collection<Map<A, B>> maps) {
  MultiMap<A, B> mm = null;
  for (Map<A, B> m : maps) {
    if (mm == null) mm = emptyMultiMapSimilarToMap(m);
    mm.putAll(m);
  }
  ret uniquifyMultiMapValues(mm);
}

Author comment

Began life as a copy of #1004287

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1023858
Snippet name: mergeMapsToMultiMap - merge maps into a multi map. uniquify values
Eternal ID of this version: #1023858/3
Text MD5: ae3598de91da0f8b839fca5c3960605c
Transpilation MD5: a350a0eec5f60ed88b9099f74b1f84b6
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-07-10 17:34:13
Source code size: 373 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 205 / 290
Version history: 2 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)