Libraryless. Click here for Pure Java version (3857L/22K).
1 | static <A, B> Map<A, B> filterMap(Map<A, B> map, IF2<A, B, Bool> f) { |
2 | if (map == null) null; |
3 | Map<A, B> m2 = similarEmptyMap(map); |
4 | for (A a, B b : map) { |
5 | if (f.get(a, b)) |
6 | m2.put(a, b); |
7 | } |
8 | ret m2; |
9 | } |
10 | |
11 | static <A, B> Map<A, B> curry1Like filterMap(IF2<A, B, Bool> f, Map<A, B> map) { |
12 | ret filterMap(map, f); |
13 | } |
14 | |
15 | static <A, B> Map<A, B> filterMap(Map<A, B> map, A... keys) { |
16 | ret getMultipleKeys(map, keys); |
17 | } |
18 | |
19 | |
20 | |
21 | static <A, B> Map<A, B> filterMap(Map<A, B> map, Iterable<A> keys) { |
22 | ret getMultipleKeys(map, keys); |
23 | } |
Began life as a copy of #1008064
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1009585 |
Snippet name: | filterMap - filter map by func(A, B) -> Bool. also synonym of getMultipleKeys |
Eternal ID of this version: | #1009585/12 |
Text MD5: | 529e0c8ae0962bda42b78f8143b5fc5c |
Transpilation MD5: | 841e7d9f988f6bc523755de6f744438f |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-09-13 16:06:27 |
Source code size: | 553 bytes / 23 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 552 / 636 |
Version history: | 11 change(s) |
Referenced in: | [show references] |