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

15
LINES

< > BotCompany Repo | #1020213 // mapMultiMapValues - apply function to a MultiMap's values

JavaX fragment (include)

1  
static MultiMap mapMultiMapValues(O func, MultiMap mm) {
2  
  MultiMap m = similarEmptyMultiMap(mm);
3  
  for (O key : keys(mm))
4  
    for (O value : mm.get(key))
5  
      m.put(key, callF(func, value));
6  
  ret m;
7  
}
8  
9  
static MultiMap mapMultiMapValues(MultiMap mm, O func) {
10  
  ret mapMultiMapValues(func, mm);
11  
}
12  
13  
static <A, B, C> MultiMap<A, C> lambdaMapLike mapMultiMapValues(IF1<B, C> func, MultiMap<A, B> mm) {
14  
  ret mapMultiMapValues((O) func, mm);
15  
}

Author comment

Began life as a copy of #1004652

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1020213
Snippet name: mapMultiMapValues - apply function to a MultiMap's values
Eternal ID of this version: #1020213/8
Text MD5: a5e3de79890ca9aaec22d3e82ca046d0
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-05-21 17:37:09
Source code size: 455 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 331 / 407
Version history: 7 change(s)
Referenced in: [show references]