Libraryless. Click here for Pure Java version (57L/1K).
1 | // not a very good one |
2 | sbool instanceOf(O o, S className) { |
3 | if (o == null) false; |
4 | S c = o.getClass().getName(); |
5 | ret eq(c, className) || eq(c, "main$" + className); |
6 | } |
7 | |
8 | // better |
9 | sbool instanceOf(O o, Class c) { |
10 | if (c == null) false; |
11 | ret c.isInstance(o); |
12 | } |
13 | |
14 | sbool instanceOf(Class c, O o) { |
15 | ret instanceOf(o, c); |
16 | } |
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1001985 |
Snippet name: | instanceOf |
Eternal ID of this version: | #1001985/3 |
Text MD5: | 306ee85dcb07940a18b48cf389b37131 |
Transpilation MD5: | 89ff7307d686b4d0e42bd96ae35932e0 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-01-23 20:48:49 |
Source code size: | 339 bytes / 16 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 729 / 1340 |
Version history: | 2 change(s) |
Referenced in: | [show references] |