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

15
LINES

< > BotCompany Repo | #1004806 // filterByType - only return instances of some class from collection

JavaX fragment (include)

static <A> L<A> filterByType(Iterable c, Class<A> type) {
  new L<A> l;
  if (c != null) for (O x : c)
    if (isInstanceX(type, x))
      l.add((A) x);
  ret l;
}

static <A> L<A> filterByType(O[] c, Class<A> type) {
  ret filterByType(asList(c), type);
}

static <A> L<A> filterByType(Class<A> type, Iterable c) {
  ret filterByType(c, type);
}

Author comment

Began life as a copy of #1002319

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: #1004806
Snippet name: filterByType - only return instances of some class from collection
Eternal ID of this version: #1004806/4
Text MD5: d95ef555486b5c2e41ffbbcd4bb4a4f8
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-07-06 18:24:03
Source code size: 360 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 542 / 562
Version history: 3 change(s)
Referenced in: [show references]