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

11
LINES

< > BotCompany Repo | #1026441 // flattenArray_recursive - also flattens collections inside array. hopefully works

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

Libraryless. Click here for Pure Java version (2159L/14K).

1  
static O[] flattenArray_recursive(O... a) {
2  
  new L l;
3  
  if (a != null) for (O x : a)
4  
    if (x cast O[])
5  
      l.addAll(flattenList2(asList(x)));
6  
    else if (x cast Collection)
7  
      l.addAll(flattenList2(x));
8  
    else
9  
      l.add(x);
10  
  ret asObjectArray(l);
11  
}

Author comment

Began life as a copy of #1010282

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1026441
Snippet name: flattenArray_recursive - also flattens collections inside array. hopefully works
Eternal ID of this version: #1026441/3
Text MD5: 686fbe5aa0c376a65deff343ea9532c5
Transpilation MD5: 981fb650fd72627eaa4fa97ed1672d77
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-01-04 16:18:47
Source code size: 272 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 162 / 239
Version history: 2 change(s)
Referenced in: [show references]