Libraryless. Click here for Pure Java version (2209L/14K).
1 | static <A> Runnable rWatcher_noRunFirstTime(IF0<A> calc, Runnable r) { |
2 | ret rWatcher_noRunFirstTime(calc, runnableToIVF1(r)); |
3 | } |
4 | |
5 | static <A> Runnable rWatcher_noRunFirstTime(IF0<A> calc, IVF1<A> r) { |
6 | ret new Runnable { |
7 | A value = callF(calc); |
8 | |
9 | run { |
10 | A newValue = callF(calc); |
11 | if (neq(value, newValue)) { |
12 | value = newValue; |
13 | callF(r, value); |
14 | } |
15 | } |
16 | }; |
17 | } |
Began life as a copy of #1024376
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1027607 |
Snippet name: | rWatcher_noRunFirstTime - wrap a Runnable & only run it if a value has changed |
Eternal ID of this version: | #1027607/2 |
Text MD5: | a4abbf6ee366fa5dc6cab141046038ee |
Transpilation MD5: | 716f7219dfb3f7c21b7ae64dfcd30655 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-03-25 20:28:31 |
Source code size: | 416 bytes / 17 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 215 / 296 |
Version history: | 1 change(s) |
Referenced in: | [show references] |