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

11
LINES

< > BotCompany Repo | #1012283 // smallestList_fromList

JavaX fragment (include)

1  
static O smallestList_fromList(L e) {
2  
  int n = l(e);
3  
  smallestList_checkElements(e);
4  
  switch (n) {
5  
    case 0: ret null;
6  
    case 1: ret e.get(0);
7  
    case 2: ret pair(e.get(0), e.get(1));
8  
    case 3: ret triple(e.get(0), e.get(1), e.get(2));
9  
    default: ret toObjectArray(e);
10  
  }
11  
}

Author comment

Began life as a copy of #1011504

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1012283
Snippet name: smallestList_fromList
Eternal ID of this version: #1012283/1
Text MD5: 5f8cc075b93f7a53fdb4b34a1abd8c84
Author: stefan
Category: javax / collections
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-11-27 10:52:12
Source code size: 296 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 317 / 379
Referenced in: [show references]