Libraryless. Click here for Pure Java version (1642L/11K).
1 | static <A> Runnable rWatcher(IF0<A> calc, Runnable r) { |
2 | ret new Runnable { |
3 | A value; |
4 | |
5 | run { |
6 | A newValue = callF(calc); |
7 | if (neq(value, newValue)) { |
8 | value = newValue; |
9 | callF(r); |
10 | } |
11 | } |
12 | }; |
13 | } |
download show line numbers debug dex old transpilations
Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1024376 |
Snippet name: | rWatcher - wrap a Runnable & only run it if a value has changed. executes the first time |
Eternal ID of this version: | #1024376/4 |
Text MD5: | 6575c648a629d6464505991ae4358d02 |
Transpilation MD5: | 96b299cafc87d94bd6a4a271c16546e7 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-08-08 14:28:08 |
Source code size: | 247 bytes / 13 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 259 / 340 |
Version history: | 3 change(s) |
Referenced in: | [show references] |