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

13
LINES

< > BotCompany Repo | #1002568 // scanTree - return all nodes of an object tree

JavaX fragment (include)

1  
static L scanTree(O root, L<S> fields) {
2  
  new IdentityHashMap out;
3  
  scanTree_impl(root, fields, out);
4  
  ret list(out.keySet());
5  
}
6  
7  
static void scanTree_impl(O root, L<S> fields, IdentityHashMap out) {
8  
  if (root == null) ret;
9  
  if (out.containsKey(root)) ret;
10  
  out.put(root, true);
11  
  for (S field : fields)
12  
    scanTree_impl(getOpt(root, field), fields, out);
13  
}

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: #1002568
Snippet name: scanTree - return all nodes of an object tree
Eternal ID of this version: #1002568/1
Text MD5: 2b14631133a2e3aa92791587b7775870
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-02-02 16:40:57
Source code size: 376 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 564 / 501
Referenced in: [show references]