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).

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