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

10
LINES

< > BotCompany Repo | #1034849 // mapMultiSetMapKeys - apply function to a MultiSetMap's keys, merge values if two keys collapse to one

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

Libraryless. Click here for Pure Java version (5497L/30K).

1  
static <A, B, C> MultiSetMap<B, C> lambdaMapLike mapMultiSetMapKeys(IF1<A, C> f, MultiSetMap<A, B> mm) {
2  
  MultiSetMap m = similarEmptyMultiSetMap(mm);
3  
  for (key : keys(mm))
4  
    m.put(f.get(key), mm.get(key));
5  
  ret m;
6  
}
7  
8  
static <A, B, C> MultiSetMap<B, C> lambdaMapLike mapMultiSetMapKeys(MultiSetMap<A, B> mm, IF1<A, C> f) {
9  
  ret mapMultiSetMapKeys(f, mm);
10  
}

Author comment

Began life as a copy of #1024745

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1034849
Snippet name: mapMultiSetMapKeys - apply function to a MultiSetMap's keys, merge values if two keys collapse to one
Eternal ID of this version: #1034849/4
Text MD5: cc4927803c5360d30ffd5db0cff0118d
Transpilation MD5: ca2e3d8a569d727d2f21fa26489ab467
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:07
Source code size: 371 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 127 / 198
Version history: 3 change(s)
Referenced in: [show references]