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

11
LINES

< > BotCompany Repo | #1010282 // flattenArray2 - also flattens collections inside array - not recursive

JavaX fragment (include)

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

Author comment

Began life as a copy of #1003769

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1010282
Snippet name: flattenArray2 - also flattens collections inside array - not recursive
Eternal ID of this version: #1010282/2
Text MD5: 521a1e8a41e85cf49bd0083cdfe1e41a
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-01-12 20:10:28
Source code size: 266 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 635 / 664
Version history: 1 change(s)
Referenced in: [show references]