Libraryless. Click here for Pure Java version (2576L/16K).
1 | static <A, B> Map<A, B> filterByValue(Map<A, B> map, B value) { |
2 | Map<A, B> m2 = similarEmptyMap(map); |
3 | for (A key : keys(map)) { |
4 | B b = map.get(key); |
5 | if (eq(b, value)) |
6 | m2.put(key, b); |
7 | } |
8 | ret m2; |
9 | } |
10 | |
11 | static <A, B> Map<A, B> lambdaMapLike filterByValue(IPred<B> pred, Map<A, B> map) { |
12 | ret filterByValuePredicate(pred, map); |
13 | } |
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: | #1008064 |
Snippet name: | filterByValue - filter map by value. also synonym of filterByValuePredicate |
Eternal ID of this version: | #1008064/4 |
Text MD5: | 501aa2922b286d65d80bf8ab14f78606 |
Transpilation MD5: | 7cc641f107e2d7e2307b895ff986d6b0 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-11-30 13:49:28 |
Source code size: | 354 bytes / 13 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 520 / 589 |
Version history: | 3 change(s) |
Referenced in: | [show references] |