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

7
LINES

< > BotCompany Repo | #1021319 // addAllNonNulls

JavaX fragment (include)

static <A, B extends A> void addAllNonNulls(Collection<A> c, Iterable<B> b) {
  if (c != null && b != null) for (A a : b) if (a != null) c.add(a);
}

static <A, B extends A> void addAllNonNulls(Collection<A> c, B... b) {
  if (c != null && b != null) for (A a : b) if (a != null) c.add(a);
}

Author comment

Began life as a copy of #1004686

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: #1021319
Snippet name: addAllNonNulls
Eternal ID of this version: #1021319/1
Text MD5: 477649b46a0d738e703253e0c5018743
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-02-08 16:32:55
Source code size: 297 bytes / 7 lines
Pitched / IR pitched: No / No
Views / Downloads: 357 / 397
Referenced in: [show references]