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

6
LINES

< > BotCompany Repo | #1004821 // firstOfType - return first element of collection that is of some type

JavaX fragment (include)

static <A> A firstOfType(Collection c, Class<A> type) {
  for (O x : c)
    if (isInstanceX(type, x))
      ret (A) x;
  ret null;
}

Author comment

Began life as a copy of #1004806

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1004821
Snippet name: firstOfType - return first element of collection that is of some type
Eternal ID of this version: #1004821/1
Text MD5: eacaaf1f1c3dbb45939e0ef16e13c602
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-09-02 14:19:32
Source code size: 137 bytes / 6 lines
Pitched / IR pitched: No / No
Views / Downloads: 580 / 597
Referenced in: [show references]