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

11
LINES

< > BotCompany Repo | #1030849 // flattenStringArray2 - also flattens collections inside array - not recursive

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

Libraryless. Click here for Pure Java version (2753L/16K).

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

Author comment

Began life as a copy of #1010282

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1030849
Snippet name: flattenStringArray2 - also flattens collections inside array - not recursive
Eternal ID of this version: #1030849/1
Text MD5: 2db22def0a4cda956a4ec646e3e8ccfb
Transpilation MD5: 996e0b48adfe2f69710b146d438436cb
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-04-02 22:11:13
Source code size: 241 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 106 / 160
Referenced in: [show references]