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)

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

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: 566 / 589
Version history: 1 change(s)
Referenced in: [show references]