Libraryless. Click here for Pure Java version (68L/1K).
1 | static <A, B> int countKeysWithValue(Map<A, B> map, B value) {
|
2 | int n = 0; |
3 | for (A key : keys(map)) |
4 | if (eq(map.get(key), value)) |
5 | ++n; |
6 | ret n; |
7 | } |
8 | |
9 | static <A, B> int countKeysWithValue(B value, Map<A, B> map) { |
10 | ret countKeysWithValue(map, value); |
11 | } |
Began life as a copy of #1008062
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: | #1028090 |
| Snippet name: | countKeysWithValue |
| Eternal ID of this version: | #1028090/2 |
| Text MD5: | c1ea1fddcee16346607269036d9f8245 |
| Transpilation MD5: | b845bef5b5b0ebd2335f8e819a6a591f |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2020-05-18 14:08:38 |
| Source code size: | 266 bytes / 11 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 450 / 585 |
| Version history: | 1 change(s) |
| Referenced in: | [show references] |