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).

1  
static int subclassDistance(Class a, Class b) {
2  
  int n = 0;
3  
  while (a != b) {
4  
    a = a.getSuperclass();
5  
    if (a == null) ret Int.MAX_VALUE;
6  
    ++n;
7  
  }
8  
  ret n;
9  
}

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: 136 / 190
Referenced in: [show references]