Libraryless. Click here for Pure Java version (2847L/17K).
sclass OrError<A> extends Var<A> { O error; // usually a Throwable *() {} *(A value) { super(value); } *(bool dummy, O *error) { assertNotNull(error); } bool ok() { ret error == null; } O error() { ret error; } static <B> OrError<B> ok(B a) { ret new OrError(a); } static OrError error(O error) { ret new OrError(true, error); } toString { ret ok() ? super.toString() : str(error); } }
Began life as a copy of #1012580
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1029592 |
Snippet name: | OrError - v2 of OKOrError |
Eternal ID of this version: | #1029592/6 |
Text MD5: | e0feb3a467b5d0b850ab7a7b5c694a1f |
Transpilation MD5: | 1a538ab9d1a8762b0d166ee07a91a48a |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-03-18 20:06:52 |
Source code size: | 451 bytes / 19 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 284 / 567 |
Version history: | 5 change(s) |
Referenced in: | [show references] |