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

18
LINES

< > BotCompany Repo | #1022198 // allInterfacesImplementedBy (including c itself if it is an interface)

JavaX fragment (include)

static Set<Class> allInterfacesImplementedBy(O o) {
  ret allInterfacesImplementedBy(_getClass(o));
}

static Set<Class> allInterfacesImplementedBy(Class c) {
  if (c == null) null;
  new HashSet<Class> set;
  allInterfacesImplementedBy_find(c, set);
  ret set;
}

svoid allInterfacesImplementedBy_find(Class c, Set<Class> set) {
  if (c.isInterface() && !set.add(c)) ret;
  do {
    for (Class intf : c.getInterfaces())
      allInterfacesImplementedBy_find(intf, set);
  } while ((c = c.getSuperclass()) != null);
}

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1022198
Snippet name: allInterfacesImplementedBy (including c itself if it is an interface)
Eternal ID of this version: #1022198/6
Text MD5: 96a668abbfa8a40a2a9a0f59583a26fa
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-04-14 23:48:48
Source code size: 534 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 239 / 309
Version history: 5 change(s)
Referenced in: [show references]