Libraryless. Click here for Pure Java version (2158L/14K).
static int toInt(O o) { if (o == null) ret 0; if (o cast Number) ret o.intValue(); if (o cast S) ret parseInt(o); if (o cast Bool) ret boolToInt(o); throw fail("woot not int: " + getClassName(o)); } static int toInt(long l) { if (l != (int) l) fail("Too large for int: " + l); ret (int) l; }
download show line numbers debug dex old transpilations
Travelled to 20 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, ekrmjmnbrukm, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt, whxojlpjdney, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1002621 |
Snippet name: | toInt |
Eternal ID of this version: | #1002621/3 |
Text MD5: | 8294c654949d3c90652aefd682dd0488 |
Transpilation MD5: | 5c00ea5cefb847edd0ec3e26140e0cb0 |
Author: | stefan |
Category: | javax / eleu |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-01-11 20:28:59 |
Source code size: | 332 bytes / 15 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 848 / 1772 |
Version history: | 2 change(s) |
Referenced in: | [show references] |