1 | static <A, B> void dropValuesFromMapOtherThan(Map<A, B> map, B... values) { |
2 | HashSet<B> valueSet = new HashSet(Arrays.asList(values)); |
3 | for (Iterator<Map.Entry<A, B>> it = map.entrySet().iterator(); it.hasNext();) |
4 | if (!valueSet.contains(it.next().getValue())) it.remove(); |
5 | } |
Began life as a copy of #1010873
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: | #1010874 |
Snippet name: | dropValuesFromMapOtherThan - modifies original map |
Eternal ID of this version: | #1010874/2 |
Text MD5: | 8a9646b9e34176d71c3a20f37669ed25 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-10-05 00:17:30 |
Source code size: | 284 bytes / 5 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 486 / 499 |
Version history: | 1 change(s) |
Referenced in: | [show references] |