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

35
LINES

< > BotCompany Repo | #1005301 - pcallF - synonym of pcallFunction

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

Libraryless. Click here for Pure Java version (3891L/22K).

1  
static O pcallF(O f, O... args) {
2  
  ret pcallFunction(f, args);
3  
}
4  
5  
ifclass F0
6  
static <A> A pcallF(F0<A> f) null on exception {
7  
  ret f?!;
8  
}
9  
endif
10  
11  
ifclass F1
12  
static <A, B> B pcallF(F1<A, B> f, A a) null on exception {
13  
  ret f?.get(a);
14  
}
15  
endif
16  
17  
ifclass VF1
18  
static <A> void pcallF(VF1<A> f, A a) {
19  
  pcall {
20  
    f?.get(a);
21  
  }
22  
}
23  
endif
24  
25  
static O pcallF(Runnable r) null on exception {
26  
  r?.run(); null;
27  
}
28  
29  
static <A> A pcallF(IF0<A> f) null on exception {
30  
  ret f?!;
31  
}
32  
33  
static <A, B> B pcallF(IF1<A, B> f, A a) null on exception {
34  
  ret f?.get(a);
35  
}

Author comment

Began life as a copy of #1003403

download  show line numbers  debug dex  old transpilations   

Travelled to 21 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, ekrmjmnbrukm, gwrvuhgaqvyk, ishqpsrjomds, jcllbfdqhrgy, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, onxytkatvevr, podlckwnjdmb, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, whxojlpjdney, yanjaxplzisb

No comments. add comment

Snippet ID: #1005301
Snippet name: pcallF - synonym of pcallFunction
Eternal ID of this version: #1005301/10
Text MD5: 2d371b05c7c20b824b5e3abc495240f6
Transpilation MD5: 6d292802348e5da967aff548fb65e159
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-10-15 16:03:29
Source code size: 582 bytes / 35 lines
Pitched / IR pitched: No / No
Views / Downloads: 540 / 1607
Version history: 9 change(s)
Referenced in: [show references]