Libraryless. Click here for Pure Java version (2750L/16K).
1 | static Map lambdaMapLike mapKeysAndValues(O f, Map map) { |
2 | ret mapKeysAndValues(f, f, map); |
3 | } |
4 | |
5 | static Map mapKeysAndValues(O fKey, O fValue, Map map) { |
6 | if (map == null) null; |
7 | Map m = similarEmptyMap(map); |
8 | for (O key, val : (Map<O>) map) |
9 | m.put(callF(fKey, key), callF(fValue, val)); |
10 | ret m; |
11 | } |
12 | |
13 | static <A, B> Map<B> mapKeysAndValues(IF1<A, B> f, Map<A> map) { |
14 | ret mapKeysAndValues(f, f, map); |
15 | } |
16 | |
17 | static <A, B, C, D> Map<C, D> mapKeysAndValues(IF1<A, C> fKey, IF1<B, D> fValue, Map<A, B> map) { |
18 | if (map == null) null; |
19 | Map<C, D> m = similarEmptyMap(map); |
20 | for (A key, B val : map) |
21 | m.put(fKey.get(key), fValue.get(val)); |
22 | ret m; |
23 | } |
Began life as a copy of #1008376
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1014533 |
Snippet name: | mapKeysAndValues |
Eternal ID of this version: | #1014533/9 |
Text MD5: | 600f31c6a9d11cb48ab9c5edaebd879d |
Transpilation MD5: | f760e423b13474cc4e299d4ec8f83e78 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-04-26 17:57:39 |
Source code size: | 671 bytes / 23 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 465 / 570 |
Version history: | 8 change(s) |
Referenced in: | [show references] |