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)

static <A, B> LiveValue<B> mapLiveValue(final F1<A, B> f, final Class<B> type, final LiveValue<A> lv) {
  ret new LiveValue<B>() {
    public Class<B> getType() { ret type; }
    public B get() { ret callF(f, lv!); }
    public void onChange(Runnable l) { lv.onChange(l); }
    public void removeChangeListener(Runnable l) { lv.removeChangeListener(l); }
  };
}

static <A, B> LiveValue<B> mapLiveValue(LiveValue<A> lv, Class<B> type, F1<A, B> f) {
  ret mapLiveValue(f, type, lv);
}

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/5
Text MD5: 04c5b1fbe756cedcf8ae78bd61176965
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-01-24 17:05:11
Source code size: 494 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 257 / 296
Version history: 4 change(s)
Referenced in: [show references]