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

9
LINES

< > BotCompany Repo | #1035460 // subclassDistance

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

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

static int subclassDistance(Class a, Class b) {
  int n = 0;
  while (a != b) {
    a = a.getSuperclass();
    if (a == null) ret Int.MAX_VALUE;
    ++n;
  }
  ret n;
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): elmgxqgtpvxh, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1035460
Snippet name: subclassDistance
Eternal ID of this version: #1035460/1
Text MD5: c13f53876c3a485b280e7f6389d8bb78
Transpilation MD5: 6e1dfe23f17dd5e3d8b11ace1ce177cf
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-05-19 20:31:17
Source code size: 176 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 134 / 186
Referenced in: [show references]