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

22
LINES

< > BotCompany Repo | #1002022 - isEmpty - check strings or collections for emptiness

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

Transpiled version (41L) is out of date.

static boolean isEmpty(Collection c) {
  ret c == null || c.isEmpty();
}

static boolean isEmpty(CharSequence s) {
  ret s == null || s.length() == 0;
}

static bool isEmpty(O[] a) { ret a == null || a.length == 0; }
static bool isEmpty(byte[] a) { ret a == null || a.length == 0; }

static boolean isEmpty(Map map) {
  ret map == null || map.isEmpty();
}

ifclass DoubleRange
sbool isEmpty(DoubleRange r) { ret r == null || r.isEmpty(); }
endif

ifclass AppendableChain
sbool isEmpty(AppendableChain c) { ret c == null; }
endif

download  show line numbers  debug dex  old transpilations   

Travelled to 20 computer(s): aoiabmzegqzx, ayfdnjdhpjha, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, kltaiputbqfu, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, ppjhyzlbdabe, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, whxojlpjdney, xrpafgyirdlv

No comments. add comment

Snippet ID: #1002022
Snippet name: isEmpty - check strings or collections for emptiness
Eternal ID of this version: #1002022/6
Text MD5: 61243138ecf035ad8d0adb07d897237d
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-10-27 05:01:17
Source code size: 549 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 692 / 6576
Version history: 5 change(s)
Referenced in: #1002108 #1002427 #1006654 #3000382