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

11
LINES

< > BotCompany Repo | #1027783 // mapValues_pcall - apply function to a map's values

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

Libraryless. Click here for Pure Java version (2489L/16K).

static <A, B, C> Map<A, C> lambdaMapLike mapValues_pcall(IF1<B, C> f, Map<A, B> map) {
  Map<A, C> m = similarEmptyMap(map);
  for (A key : keys(map)) pcall {
    m.put(key, callF(f, map.get(key)));
  }
  ret m;
}

static <A, B, C> Map<A, C> mapValues_pcall(Map<A, B> map, IF1<B, C> f) {
  ret mapValues_pcall(f, map);
}

Author comment

Began life as a copy of #1004652

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1027783
Snippet name: mapValues_pcall - apply function to a map's values
Eternal ID of this version: #1027783/1
Text MD5: 0dee4f9821a716ad21a6d2db7f04eb9f
Transpilation MD5: b8fc56cc3a3e771fb72f22df0f8ad4a2
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-04-11 18:47:29
Source code size: 330 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 113 / 181
Referenced in: [show references]