1 | A v; // you can access this directly if you use one thread |
2 | |
3 | public synchronized void set(A a) { |
4 | if (v != a) { |
5 | v = a; |
6 | notifyAll(); |
7 | } |
8 | } |
9 | |
10 | public synchronized A get() { ret v; } |
11 | public synchronized bool has() { ret v != null; } |
12 | public void clear() { set(null); } |
13 | |
14 | public synchronized A getAndSet(A a) { |
15 | var value = v; |
16 | set(a); |
17 | ret value; |
18 | } |
19 | |
20 | public IF0<A> getter() { ret l0 get; } |
21 | public IVF1<A> setter() { ret l1 set; } |
Began life as a copy of #1023196
download show line numbers debug dex old transpilations
Travelled to 10 computer(s): bhatertpkbcr, dpqxeycirhfy, ekrmjmnbrukm, elmgxqgtpvxh, gjtlkbvenryc, mowyntqkapby, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, wnsclhtenguj
No comments. add comment
Snippet ID: | #1032845 |
Snippet name: | Var [Include without toString] |
Eternal ID of this version: | #1032845/9 |
Text MD5: | 798334d0cba6305050a9e11b2f6230a8 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-06-27 02:44:26 |
Source code size: | 452 bytes / 21 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 171 / 15529 |
Version history: | 8 change(s) |
Referenced in: | [show references] |