sclass WeakHashSet<A> extends AbstractSet<A> { Map<A, Bool> map = newWeakHashMap(); public int size() { ret map.size(); } public Iterator<A> iterator() { ret keys(map).iterator(); } public bool contains(O o) { ret map.containsKey(o); } public bool add(A a) { ret map.put(a, Bool.TRUE) != null; } public bool remove(O o) { ret map.remove(o) != null; } O mutex() { ret collectionMutex(map); } }
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1011596 |
Snippet name: | WeakHashSet (hopefully complete, synchronized) |
Eternal ID of this version: | #1011596/8 |
Text MD5: | 7b4383335b06d9e412fc848b5735521b |
Author: | stefan |
Category: | javax / collections |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-01-11 15:13:34 |
Source code size: | 434 bytes / 14 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 561 / 2255 |
Version history: | 7 change(s) |
Referenced in: | [show references] |