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

14
LINES

< > BotCompany Repo | #1028477 // classSuperclassesAndInterfaces

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (39L/1K).

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

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

Author comment

Began life as a copy of #1022198

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1028477
Snippet name: classSuperclassesAndInterfaces
Eternal ID of this version: #1028477/2
Text MD5: 4ceb605d3623d10a596fae2194521cbe
Transpilation MD5: b4a0645ddf364d37306d056eb768aa9d
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-06-21 01:47:46
Source code size: 426 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 171 / 261
Version history: 1 change(s)
Referenced in: [show references]