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

3
LINES

< > BotCompany Repo | #1023077 // singletonUnlessNull - return list with a single argument if it's not null (empty list otherwise)

JavaX fragment (include)

1  
static <A> L<A> singletonUnlessNull(A a) {
2  
  ret a == null ? emptyList() : ll(a);
3  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1023077
Snippet name: singletonUnlessNull - return list with a single argument if it's not null (empty list otherwise)
Eternal ID of this version: #1023077/3
Text MD5: a3cab2ffe58c13803579c291a5c1bdce
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-05-02 17:17:44
Source code size: 85 bytes / 3 lines
Pitched / IR pitched: No / No
Views / Downloads: 305 / 337
Version history: 2 change(s)
Referenced in: [show references]