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.

1  
static boolean isEmpty(Collection c) {
2  
  ret c == null || c.isEmpty();
3  
}
4  
5  
static boolean isEmpty(CharSequence s) {
6  
  ret s == null || s.length() == 0;
7  
}
8  
9  
static bool isEmpty(O[] a) { ret a == null || a.length == 0; }
10  
static bool isEmpty(byte[] a) { ret a == null || a.length == 0; }
11  
12  
static boolean isEmpty(Map map) {
13  
  ret map == null || map.isEmpty();
14  
}
15  
16  
ifclass DoubleRange
17  
sbool isEmpty(DoubleRange r) { ret r == null || r.isEmpty(); }
18  
endif
19  
20  
ifclass AppendableChain
21  
sbool isEmpty(AppendableChain c) { ret c == null; }
22  
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: 696 / 6583
Version history: 5 change(s)
Referenced in: [show references]