Libraryless. Click here for Pure Java version (2100L/14K).
1  | static <A, B, C, D> Map<C, D> mapMapToMap(IF2<A, B, Pair<C, D>> f, Map<A, B> m) {
 | 
2  | if (m == null) null;  | 
3  | Map<C, D> map = similarEmptyMap(m);  | 
4  |   for (Map.Entry<A, B> e : m.entrySet()) {
 | 
5  | Pair<C, D> p = f.get(e.getKey(), e.getValue());  | 
6  | map.put(p.a, p.b);  | 
7  | }  | 
8  | ret map;  | 
9  | }  | 
10  | |
11  | static <A, B, C, D> Map<C, D> mapMapToMap(Map<A, B> m, IF2<A, B, Pair<C, D>> f) {
 | 
12  | ret mapMapToMap(f, m);  | 
13  | }  | 
Began life as a copy of #1024294
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: | #1025202 | 
| Snippet name: | mapMapToMap - map a Map to a similar type Map using a function taking two arguments and returning a pair | 
| Eternal ID of this version: | #1025202/5 | 
| Text MD5: | fbb21ed26808ded23f3487600ab714eb | 
| Transpilation MD5: | c4d2aff4314662623642f4712fbafd22 | 
| Author: | stefan | 
| Category: | javax | 
| Type: | JavaX fragment (include) | 
| Public (visible to everyone): | Yes | 
| Archived (hidden from active list): | No | 
| Created/modified: | 2019-09-13 13:31:39 | 
| Source code size: | 399 bytes / 13 lines | 
| Pitched / IR pitched: | No / No | 
| Views / Downloads: | 720 / 1001 | 
| Version history: | 4 change(s) | 
| Referenced in: | [show references] |