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)

static L scanTree(O root, L<S> fields) {
  new IdentityHashMap out;
  scanTree_impl(root, fields, out);
  ret list(out.keySet());
}

static void scanTree_impl(O root, L<S> fields, IdentityHashMap out) {
  if (root == null) ret;
  if (out.containsKey(root)) ret;
  out.put(root, true);
  for (S field : fields)
    scanTree_impl(getOpt(root, field), fields, out);
}

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: 621 / 562
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#3000382 - Answer for ferdie (>> t = 1, f = 0)