Transpiled version (8992L) is out of date.
sclass OKOrError<A> implements IF0<A> { A value; gettable Throwable error; *() {} *(A *value) {} *(bool dummy, Throwable *error) { assertNotNull(error); } bool ok aka isOK() { ret error == null; } bool isError() { ret error != null; } toString { ret ok() ? /*"OK: " +*/ str(value) : "Error: " + str(error); } public A get() { ret !ok() ? null : value; } public A getMandatory() { if (!ok()) throw rethrow(error); ret value; } static <A> OKOrError<A> ok(A a) { ret new OKOrError(a); } static OKOrError error(Throwable error) { ret new OKOrError(false, error); } void setValue(A value) { this.value = value; error = null; } void setError(Throwable error) { this.value = null; this.error = error; } void copyFrom(OKOrError<A> x) { value = x.value; error = x.error; } }
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ekrmjmnbrukm, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1012580 |
| Snippet name: | OKOrError |
| Eternal ID of this version: | #1012580/13 |
| Text MD5: | 99e55d296718838172efbc51793c673a |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2022-04-02 14:58:50 |
| Source code size: | 908 bytes / 39 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 811 / 1684 |
| Version history: | 12 change(s) |
| Referenced in: | [show references] |