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

static O[] flattenArray_recursive(O... a) {
  new L l;
  if (a != null) for (O x : a)
    if (x cast O[])
      l.addAll(flattenList2(asList(x)));
    else if (x cast Collection)
      l.addAll(flattenList2(x));
    else
      l.add(x);
  ret asObjectArray(l);
}

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: 97 / 155
Version history: 2 change(s)
Referenced in: [show references]