1 | // uses identity to compare a and new value |
2 | static class WeakAssoc<A, B> {
|
3 | O f; // func(A) -> B |
4 | WeakReference<A> a; |
5 | B b; |
6 | |
7 | *() {}
|
8 | *(O *f) {}
|
9 | |
10 | synchronized B get(A a) {
|
11 | if (a != (this.a != null ? this.a.get() : null)) {
|
12 | b = (B) callF(f, a); |
13 | this.a = new WeakReference(a); |
14 | } |
15 | ret b; |
16 | } |
17 | } |
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, wtqryiryparv
No comments. add comment
| Snippet ID: | #1007503 |
| Snippet name: | WeakAssoc |
| Eternal ID of this version: | #1007503/3 |
| Text MD5: | 9cc877571b659caa2e3bdc91e1023637 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2017-03-25 17:28:57 |
| Source code size: | 338 bytes / 17 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 818 / 2029 |
| Version history: | 2 change(s) |
| Referenced in: | [show references] |