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

18
LINES

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

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

Transpiled version (2503L) is out of date.

1  
static LinkedHashMap lambdaMapLike mapValuesToLinkedHashMap(O func, Map map) {
2  
  new LinkedHashMap m;
3  
  for (O key : keys(map))
4  
    m.put(key, callF(func, map.get(key)));
5  
  ret m;
6  
}
7  
8  
static <A, B, C> LinkedHashMap<A, C> mapValuesToLinkedHashMap(Map<A, B> map, IF1<B, C> f) {
9  
  ret mapValuesToLinkedHashMap(f, map);
10  
}
11  
12  
static <A, B, C> LinkedHashMap<A, C> mapValuesToLinkedHashMap(IF1<B, C> f, Map<A, B> map) {
13  
  ret mapValuesToLinkedHashMap((O) f, map);
14  
}
15  
16  
static LinkedHashMap mapValuesToLinkedHashMap(Map map, O func) {
17  
  ret mapValuesToLinkedHashMap(func, map);
18  
}

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: #1028172
Snippet name: mapValuesToLinkedHashMap - apply function to a map's values
Eternal ID of this version: #1028172/2
Text MD5: e67591be124a2c2b366365180ee8a8aa
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-05-26 12:26:23
Source code size: 583 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 207 / 319
Version history: 1 change(s)
Referenced in: [show references]