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

11
LINES

< > BotCompany Repo | #1002091 // nullIfEmpty - convert empty thing to null

JavaX fragment (include)

1  
static S nullIfEmpty(S s) {
2  
  ret isEmpty(s) ? null : s;
3  
}
4  
5  
static <A, B> Map<A, B> nullIfEmpty(Map<A, B> map) {
6  
  ret isEmpty(map) ? null : map;
7  
}
8  
9  
static <A> L<A> nullIfEmpty(L<A> l) {
10  
  ret isEmpty(l) ? null : l;
11  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1002091
Snippet name: nullIfEmpty - convert empty thing to null
Eternal ID of this version: #1002091/7
Text MD5: 3e38bf16fdbb23f164f7e2848d323434
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-04-01 15:24:59
Source code size: 227 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 614 / 953
Version history: 6 change(s)
Referenced in: [show references]