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

11
LINES

< > BotCompany Repo | #1015350 // addUnlessNull - returns element

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

Transpiled version (29L) is out of date.

1  
static <A> A addUnlessNull(Collection<A> l, A a) {
2  
  if (l != null && a != null) l.add(a);
3  
  ret a;
4  
}
5  
6  
ifclass MultiSet
7  
static <A> A addUnlessNull(MultiSet<A> ms, A a) {
8  
  if (ms != null && a != null) ms.add(a);
9  
  ret a;
10  
}
11  
endif

Author comment

Began life as a copy of #1005547

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: #1015350
Snippet name: addUnlessNull - returns element
Eternal ID of this version: #1015350/6
Text MD5: f02fdb479cab61ad323c45fcccc6a5f3
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-08-07 00:55:04
Source code size: 238 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 371 / 454
Version history: 5 change(s)
Referenced in: [show references]