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

10
LINES

< > BotCompany Repo | #1024745 // mapMultiMapKeys - apply function to a MultiMap's keys, merge values if two keys collapse to one

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

Transpiled version (5520L) is out of date.

static <A, B, C> MultiMap<B, C> lambdaMapLike mapMultiMapKeys(IF1<A, C> f, MultiMap<A, B> mm) {
  MultiMap m = similarEmptyMultiMap(mm);
  for (key : keys(mm))
    m.put(f.get(key), mm.get(key));
  ret m;
}

static <A, B, C> MultiMap<B, C> lambdaMapLike mapMultiMapKeys(MultiMap<A, B> mm, IF1<A, C> f) {
  ret mapMultiMapKeys(f, mm);
}

Author comment

Began life as a copy of #1020213

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1024745
Snippet name: mapMultiMapKeys - apply function to a MultiMap's keys, merge values if two keys collapse to one
Eternal ID of this version: #1024745/8
Text MD5: 9e8255755f9685f9384f94c8e536eaa8
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-03-11 06:19:37
Source code size: 344 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 165 / 257
Version history: 7 change(s)
Referenced in: [show references]