Libraryless. Click here for Pure Java version (2811L/17K).
1 | static <A> ISetAndGet<A> iSetAndGet(ISetter<A> setter, IF0<A> getter) { |
2 | ret new ISetAndGet<A> { |
3 | public void set(A a) { setter?.set(a); } |
4 | public A get() { ret getter?!; } |
5 | }; |
6 | } |
7 | |
8 | static <A, B> ISetAndGet<A> iSetAndGet(B target, IVF2<B, A> setter, IF1<B, A> getter) { |
9 | ret new ISetAndGet<A> { |
10 | public void set(A a) { if (target != null && setter != null) setter.get(target, a); } |
11 | public A get() { ret target == null || getter == null ? null : getter.get(target); } |
12 | }; |
13 | } |
Began life as a copy of #1031577
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt
No comments. add comment
Snippet ID: | #1031578 |
Snippet name: | iSetAndGet |
Eternal ID of this version: | #1031578/8 |
Text MD5: | 1dd126ad827d140df2c8930ebe677aa4 |
Transpilation MD5: | 19cfd99d54729db0b666b06cc661dcf3 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-06-22 06:57:51 |
Source code size: | 499 bytes / 13 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 185 / 278 |
Version history: | 7 change(s) |
Referenced in: | [show references] |