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

11
LINES

< > BotCompany Repo | #1017186 // addAndReturnIfNotNull

JavaX fragment (include)

1  
static <A> A addAndReturnIfNotNull(Collection<A> l, A a) {
2  
  if (a != null && l != null) l.add(a);
3  
  ret a;
4  
}
5  
6  
ifclass MultiSet
7  
static <A> A addAndReturnIfNotNull(MultiSet<A> ms, A a) {
8  
  if (a != null && ms != 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 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1017186
Snippet name: addAndReturnIfNotNull
Eternal ID of this version: #1017186/1
Text MD5: ba892ae9fb078978727fda3b45cf21e5
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-07-13 18:02:49
Source code size: 254 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 379 / 390
Referenced in: [show references]