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


< > BotCompany Repo | #1001914 // emptyList - returning a new list now cause want mutable lists

JavaX fragment (include)

static ArrayList emptyList() {
  ret new ArrayList;
  //ret Collections.emptyList();

static ArrayList emptyList(int capacity) {
  ret new ArrayList(max(0, capacity));

// Try to match capacity
static ArrayList emptyList(Iterable l) {
  ret l instanceof Collection ? emptyList(((Collection) l).size()) : emptyList();

static ArrayList emptyList(O[] l) {
  ret emptyList(l(l));

// get correct type at once
static <A> ArrayList<A> emptyList(Class<A> c) {
  ret new ArrayList;

download  show line numbers  debug dex  old transpilations   

Travelled to 20 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, jtubtzbbkimh, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, whxojlpjdney, wtqryiryparv, xrpafgyirdlv

No comments. add comment

Snippet ID: #1001914
Snippet name: emptyList - returning a new list now cause want mutable lists
Eternal ID of this version: #1001914/10
Text MD5: 6ea5405862b02bd3833cd18e00a16849
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-23 15:03:20
Source code size: 505 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 820 / 7657
Version history: 9 change(s)
Referenced in: [show references]