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

static <A> A assertNotNull(A a) {
  assertTrue(a != null);
  ret a;
}

static <A> A assertNotNull(S msg, A a) {
  assertTrue(msg, a != null);
  ret a;
}

ifclass Scorer
static <A> A assertNotNull(Scorer scorer, S msg, A a) {
  if (scorer == null) ret assertNotNull(msg, a);
  if (a == null) {
    print("BAD - " + msg + " is null: " + a);
    scorer.add(false);
  } else {
    print("OK, " + msg + " not null: " + a);
    scorer.add(true);
  }
  ret a;
}
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: 773 / 1378
Version history: 5 change(s)
Referenced in: #1002427 - Accellerating 629 (SPIKE)
#1003426 - assertNull
#1006654 - Standard functions list 2 (LIVE, continuation of #761)