Libraryless. Click here for Pure Java version (10068L/55K).
1 | static long toLong(O o) {
|
2 | if (o instanceof Number) |
3 | ret ((Number) o).longValue(); |
4 | if (o instanceof S) |
5 | ret parseLong((S) o); |
6 | ret 0; |
7 | } |
8 | |
9 | static long toLong(Timestamp ts) {
|
10 | ret ts == null ? 0 : ts.unixDate(); |
11 | } |
12 | |
13 | static long toLong(Date d) {
|
14 | ret d == null ? 0 : d.getTime(); |
15 | } |
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, whxojlpjdney
No comments. add comment
| Snippet ID: | #1002956 |
| Snippet name: | toLong - convert to long with default 0 |
| Eternal ID of this version: | #1002956/3 |
| Text MD5: | f7680d72a89dc09fca7041b0b138002e |
| Transpilation MD5: | 70f94a29e43d49ab9d9dd2ea35de3b83 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2023-01-23 18:56:22 |
| Source code size: | 302 bytes / 15 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 1113 / 1306 |
| Version history: | 2 change(s) |
| Referenced in: | [show references] |