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)

static MultiMap mapMultiMapValues(O func, MultiMap mm) {
  MultiMap m = similarEmptyMultiMap(mm);
  for (O key : keys(mm))
    for (O value : mm.get(key))
      m.put(key, callF(func, value));
  ret m;
}

static MultiMap mapMultiMapValues(MultiMap mm, O func) {
  ret mapMultiMapValues(func, mm);
}

static <A, B, C> MultiMap<A, C> lambdaMapLike mapMultiMapValues(IF1<B, C> func, MultiMap<A, B> mm) {
  ret mapMultiMapValues((O) func, mm);
}

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: 253 / 319
Version history: 7 change(s)
Referenced in: [show references]