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)

1  
static <A> L<A> collectInstances(Iterable i, Class<A> c) {
2  
  new L l;
3  
  if (i == null) ret l;
4  
  c = primitiveToBoxedTypeOpt(c);
5  
  for (O o : i)
6  
    if (isInstance(c, o))
7  
      l.add(o);
8  
  ret l;
9  
}
10  
11  
static <A> L<A> collectInstances(Class<A> c, Iterable i) {
12  
  ret collectInstances(i, c);
13  
}

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: 607 / 639
Version history: 4 change(s)
Referenced in: [show references]