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)

static S nullIfEmpty(S s) {
  ret isEmpty(s) ? null : s;
}

static <A, B> Map<A, B> nullIfEmpty(Map<A, B> map) {
  ret isEmpty(map) ? null : map;
}

static <A> L<A> nullIfEmpty(L<A> l) {
  ret isEmpty(l) ? null : l;
}

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: 706 / 1053
Version history: 6 change(s)
Referenced in: [show references]