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

8
LINES

< > BotCompany Repo | #1034565 // castTo - cast to type or fail (null is allowed)

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

Libraryless. Click here for Pure Java version (9179L/50K).

static <A> A nuLike castTo(Class<A> c, O o) {
  assertInstanceOfOrNull(o, c);
  ret (A) o;
}

static <A> A nuLike castTo(O o, Class<A> c) {
  ret castTo(c, o);
}

Author comment

Began life as a copy of #1005288

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, elmgxqgtpvxh, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1034565
Snippet name: castTo - cast to type or fail (null is allowed)
Eternal ID of this version: #1034565/3
Text MD5: 1f0dbe15ca5b5f3bd02f950d8033f091
Transpilation MD5: e84c554eac66beb5bf136c5f95df3395
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-02-15 21:36:28
Source code size: 164 bytes / 8 lines
Pitched / IR pitched: No / No
Views / Downloads: 207 / 269
Version history: 2 change(s)
Referenced in: [show references]