Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

12
LINES

< > BotCompany Repo | #1015555 // mapLiveValue - apply function to LiveValue

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (5820L/32K).

1  
static <A, B> LiveValue<B> mapLiveValue(final F1<A, B> f, final Class<B> type, final LiveValue<A> lv) {
2  
  ret new LiveValue<B>() {
3  
    public Class<B> getType() { ret type; }
4  
    public B get() { ret callF(f, lv!); }
5  
    public LiveValue<B> onChange(Runnable l) { lv.onChange(l); this; }
6  
    public LiveValue<B> removeChangeListener(Runnable l) { lv.removeChangeListener(l); this; }
7  
  };
8  
}
9  
10  
static <A, B> LiveValue<B> mapLiveValue(LiveValue<A> lv, Class<B> type, F1<A, B> f) {
11  
  ret mapLiveValue(f, type, lv);
12  
}

Author comment

Began life as a copy of #1015554

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1015555
Snippet name: mapLiveValue - apply function to LiveValue
Eternal ID of this version: #1015555/7
Text MD5: 7f85a7f2e23aaaf6b53acd5c76e9a11b
Transpilation MD5: 2f09db5c78f053a0c4723a6bb885ad6f
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-02-12 19:49:27
Source code size: 522 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 291 / 359
Version history: 6 change(s)
Referenced in: [show references]