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

9
LINES

< > BotCompany Repo | #1005547 // addIfNotNull

JavaX fragment (include)

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

Author comment

Began life as a copy of #1004244

download  show line numbers  debug dex  old transpilations   

Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1005547
Snippet name: addIfNotNull
Eternal ID of this version: #1005547/4
Text MD5: f143448aa732024246f5f6b8020387f2
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-06-14 18:26:31
Source code size: 223 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 642 / 663
Version history: 3 change(s)
Referenced in: [show references]