1 | // returns true if any changes |
2 | static <A> bool removeAllBut(Set<A> a, Collection<A> b) { |
3 | bool changes; |
4 | b = asSet(b); |
5 | if (a != null) for (Iterator<A> it = a.iterator(); it.hasNext(); ) |
6 | if (!contains(b, it.next())) { |
7 | it.remove(); |
8 | set changes; |
9 | } |
10 | ret changes; |
11 | } |
12 | |
13 | static <A, B> bool removeAllBut(Map<A, B> a, Collection<A> b) { |
14 | ret a != null && removeAllBut(a.keySet(), b); |
15 | } |
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1010974 |
Snippet name: | removeAllBut |
Eternal ID of this version: | #1010974/6 |
Text MD5: | 2e54763867e723c75ced560fead99892 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-11-20 16:45:24 |
Source code size: | 414 bytes / 15 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 450 / 524 |
Version history: | 5 change(s) |
Referenced in: | [show references] |