1 | // multi-level structureLines |
2 | static S structureTree(O data) { |
3 | if (data instanceof O[]) data = asList((O[]) data); |
4 | |
5 | if (data instanceof Collection) { |
6 | new L<S> l; |
7 | l.add(replaceIfEqual(shortClassName(data), "ArrayList", "L")); |
8 | for (O x : (Collection) data) |
9 | l.add(indentx(structureTree(x))); |
10 | ret fromLines(l); |
11 | } |
12 | |
13 | ifclass MultiSet |
14 | if (data instanceof MultiSet) data = multiSetToMap(data/MultiSet); |
15 | endif |
16 | |
17 | if (data instanceof Map) { |
18 | new L<S> l; |
19 | for (O key : ((Map) data).keySet()) { |
20 | O value = ((Map) data).get(key); |
21 | l.add(structureForUser(key) + " = " + structureForUser(value)); |
22 | } |
23 | ret fromLines(l); |
24 | } |
25 | |
26 | ret structureForUser(data); |
27 | } |
Began life as a copy of #1002415
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: | #1008814 |
Snippet name: | structureTree |
Eternal ID of this version: | #1008814/2 |
Text MD5: | 3c9491b8d69b2ea6cae4b3ecd5c7744c |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-06-09 03:02:50 |
Source code size: | 729 bytes / 27 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 483 / 538 |
Version history: | 1 change(s) |
Referenced in: | [show references] |