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)

static <A> A getSingletonOpt(L<A> l) {
  ret l(l) == 1 ? first(l) : null;
}

static <A> A getSingletonOpt(A[] l) {
  ret l(l) == 1 ? first(l) : null;
}

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: 522 / 491
Version history: 1 change(s)
Referenced in: [show references]