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

6
LINES

< > BotCompany Repo | #1027461 // asList_gen - always returns a new ArrayList (no wrapping). generic version accepting Object

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

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

1  
static ArrayList asList_gen(O o) {
2  
  if (o == null) new ArrayList;
3  
  if (o cast Iterable) ret asList(o);
4  
  if (o cast O[]) ret asList(o);
5  
  fail("Can't convert to list: " + className(o));
6  
}

Author comment

Began life as a copy of #1000999

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: #1027461
Snippet name: asList_gen - always returns a new ArrayList (no wrapping). generic version accepting Object
Eternal ID of this version: #1027461/2
Text MD5: 018c9f0226c8ae30d1026bff8675a48a
Transpilation MD5: f82d857a33a442869f631af3a6aba34d
Author: stefan
Category:
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-03-22 13:02:39
Source code size: 194 bytes / 6 lines
Pitched / IR pitched: No / No
Views / Downloads: 177 / 253
Version history: 1 change(s)
Referenced in: [show references]