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)

please include function holdInstance.

static <A> A heldInstance(Class<A> c) {
  L<O> l = holdInstance_l!;
  for (int i = l(l)-1; i >= 0; i--) {
    O o = l.get(i);
    if (isInstanceOf(o, c))
      ret (A) o;
  }
  fail("No instance of " + className(c) + " held");
}

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: 270 / 294
Version history: 3 change(s)
Referenced in: [show references]