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

23
LINES

< > BotCompany Repo | #1002012 // assertNotNull

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

Libraryless. Click here for Pure Java version (3162L/17K).

1  
static <A> A assertNotNull(A a) {
2  
  assertTrue(a != null);
3  
  ret a;
4  
}
5  
6  
static <A> A assertNotNull(S msg, A a) {
7  
  assertTrue(msg, a != null);
8  
  ret a;
9  
}
10  
11  
ifclass Scorer
12  
static <A> A assertNotNull(Scorer scorer, S msg, A a) {
13  
  if (scorer == null) ret assertNotNull(msg, a);
14  
  if (a == null) {
15  
    print("BAD - " + msg + " is null: " + a);
16  
    scorer.add(false);
17  
  } else {
18  
    print("OK, " + msg + " not null: " + a);
19  
    scorer.add(true);
20  
  }
21  
  ret a;
22  
}
23  
endif

Author comment

Began life as a copy of #1001598

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1002012
Snippet name: assertNotNull
Eternal ID of this version: #1002012/6
Text MD5: 7e0775e7689bee0dda94baf1e72c606f
Transpilation MD5: f933fd3e95559af95212f67aea3ff12e
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-09-07 18:02:25
Source code size: 482 bytes / 23 lines
Pitched / IR pitched: No / No
Views / Downloads: 688 / 1260
Version history: 5 change(s)
Referenced in: [show references]