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

7
LINES

< > BotCompany Repo | #1033539 // rCallFUnlessNull - call function on argument unless argument is null

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

Libraryless. Click here for Pure Java version (4527L/25K).

1  
static <A, B> B rCallFUnlessNull(A a, IF1<A, B> f) {
2  
  ret a == null ?: f?.get(a);
3  
}
4  
5  
static <A> void rCallFUnlessNull(A a, IVF1<A> f) {
6  
  if (a != null) f?.get(a);
7  
}

Author comment

Began life as a copy of #1031677

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1033539
Snippet name: rCallFUnlessNull - call function on argument unless argument is null
Eternal ID of this version: #1033539/2
Text MD5: 4e5327f9ecc54737ce0f2c495d0099aa
Transpilation MD5: 170e5383a9fb443ec9cc78de3d324ddb
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-11-01 22:50:08
Source code size: 172 bytes / 7 lines
Pitched / IR pitched: No / No
Views / Downloads: 143 / 216
Version history: 1 change(s)
Referenced in: [show references]