Libraryless. Click here for Pure Java version (7648L/43K).
1 | static <A> A singletonOpt(Collection<A> l) { |
2 | ret l(l) == 1 ? first(l) : null; |
3 | } |
4 | |
5 | static <A> A singletonOpt(A[] l) { |
6 | ret l(l) == 1 ? first(l) : null; |
7 | } |
Began life as a copy of #1005177
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: | #1015727 |
Snippet name: | singletonOpt - synonym of getSingletonOpt - return single elemtent of list if length == 1 or null otherwise |
Eternal ID of this version: | #1015727/4 |
Text MD5: | 900e5dccd8ef05d6aac3429dd0520f0d |
Transpilation MD5: | 9b605d3822dd6d11326dd1f59eac65b4 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-04-02 18:05:41 |
Source code size: | 160 bytes / 7 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 428 / 523 |
Version history: | 3 change(s) |
Referenced in: | [show references] |