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.

static <A> A addUnlessNull(Collection<A> l, A a) {
  if (l != null && a != null) l.add(a);
  ret a;
}

ifclass MultiSet
static <A> A addUnlessNull(MultiSet<A> ms, A a) {
  if (ms != null && a != null) ms.add(a);
  ret a;
}
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: 369 / 452
Version history: 5 change(s)
Referenced in: [show references]