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

11
LINES

< > BotCompany Repo | #1014828 - heldInstance - get instance of a class held by holdInstance

JavaX fragment (include)

1  
please include function holdInstance.
2  
3  
static <A> A heldInstance(Class<A> c) {
4  
  L<O> l = holdInstance_l!;
5  
  for (int i = l(l)-1; i >= 0; i--) {
6  
    O o = l.get(i);
7  
    if (isInstanceOf(o, c))
8  
      ret (A) o;
9  
  }
10  
  fail("No instance of " + className(c) + " held");
11  
}

Author comment

Began life as a copy of #1014825

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1014828
Snippet name: heldInstance - get instance of a class held by holdInstance
Eternal ID of this version: #1014828/4
Text MD5: 61fe4f16321815bf997cf2549a8e65fa
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-05-04 10:17:28
Source code size: 277 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 282 / 309
Version history: 3 change(s)
Referenced in: [show references]