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

7
LINES

< > BotCompany Repo | #1005177 // getSingletonOpt - return single elemtent of list if length == 1 or null otherwise

JavaX fragment (include)

1  
static <A> A getSingletonOpt(L<A> l) {
2  
  ret l(l) == 1 ? first(l) : null;
3  
}
4  
5  
static <A> A getSingletonOpt(A[] l) {
6  
  ret l(l) == 1 ? first(l) : null;
7  
}

Author comment

Began life as a copy of #1005176

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1005177
Snippet name: getSingletonOpt - return single elemtent of list if length == 1 or null otherwise
Eternal ID of this version: #1005177/2
Text MD5: 43e83abd4cb3a26f99e86557b7e3f9e5
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-11-04 16:33:23
Source code size: 157 bytes / 7 lines
Pitched / IR pitched: No / No
Views / Downloads: 591 / 564
Version history: 1 change(s)
Referenced in: [show references]