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

7
LINES

< > BotCompany Repo | #1032736 // nullIfEmpty_gen - convert empty thing to null

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (3800L/22K).

sO nullIfEmpty_gen(O o) {
  if (o == null) null;
  if (o cast CharSequence && empty(o)) null;
  if (o cast Cl && empty(o)) null;
  if (o cast Map && empty(o)) null;
  ret o;
}

Author comment

Began life as a copy of #1002091

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1032736
Snippet name: nullIfEmpty_gen - convert empty thing to null
Eternal ID of this version: #1032736/1
Text MD5: 590861d087f1df20dc10cc57c01cd91d
Transpilation MD5: 7bdbaa10327c3b1f05e828e4dd7c5d65
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-10-04 03:22:00
Source code size: 181 bytes / 7 lines
Pitched / IR pitched: No / No
Views / Downloads: 79 / 121
Referenced in: [show references]