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

28
LINES

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

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

Libraryless. Click here for Pure Java version (61L/1K).

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

sbool isEmpty(File f) {
  ret f == null || f.length() == 0;
}

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

sbool isEmpty(IntSize l) { ret l == null || l.size() == 0; }

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/8
Text MD5: 6d8d0e990fc9ccf6b28e480026909d2f
Transpilation MD5: 24ac405838cbb4de6831bca98bf300b7
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-12-11 20:34:01
Source code size: 680 bytes / 28 lines
Pitched / IR pitched: No / No
Views / Downloads: 1072 / 7087
Version history: 7 change(s)
Referenced in: [show references]