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

15
LINES

< > BotCompany Repo | #1024836 // mapMultiMapValueLists - apply function to a MultiMap's value lists

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

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

static MultiMap mapLike mapMultiMapValueLists(O func, MultiMap mm) {
  MultiMap m = similarEmptyMultiMap(mm);
  for (O key : keys(mm))
    for (O value : mm.getActual(key))
      m.addAll(key, (Cl) callF(func, value));
  ret m;
}

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

static <A, B, C, D extends Cl<C>> MultiMap<A, C> mapMultiMapValueLists(IF1<B, D> func, MultiMap<A, B> mm) {
  ret mapMultiMapValueLists((O) func, mm);
}

Author comment

Began life as a copy of #1020213

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: #1024836
Snippet name: mapMultiMapValueLists - apply function to a MultiMap's value lists
Eternal ID of this version: #1024836/1
Text MD5: 8ae613a134360d06a85e15b00604a541
Transpilation MD5: 79ed362593438f594918fe0b8a026dc6
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-08-26 19:22:50
Source code size: 500 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 199 / 302
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)