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

13
LINES

< > BotCompany Repo | #1004443 // collectInstances - get instance of a class from a collection

JavaX fragment (include)

static <A> L<A> collectInstances(Iterable i, Class<A> c) {
  new L l;
  if (i == null) ret l;
  c = primitiveToBoxedTypeOpt(c);
  for (O o : i)
    if (isInstance(c, o))
      l.add(o);
  ret l;
}

static <A> L<A> collectInstances(Class<A> c, Iterable i) {
  ret collectInstances(i, c);
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1004443
Snippet name: collectInstances - get instance of a class from a collection
Eternal ID of this version: #1004443/5
Text MD5: 1ae7e9a8a63061a57f4c765629f564d6
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-07-10 20:37:33
Source code size: 300 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 605 / 637
Version history: 4 change(s)
Referenced in: [show references]