Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

19
LINES

< > BotCompany Repo | #1009174 // Test Either (union type)

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (1483L/10K/35K).

!7

p {
  final Either<S, Int> a = either1('Hello);
  final Either<S, Int> b = either2(123);
  
  assertTrue(a.isA());
  assertFalse(a.isB());
  assertFalse(b.isA());
  assertTrue(b.isB());
  
  assertEqualsVerbose('Hello, a.a());
  assertFail(r { a.b() });
  
  assertEqualsVerbose(123, b.b());
  assertFail(r { b.a() });
  
  print("OK!");
}

Author comment

Began life as a copy of #1009170

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

-
Snippet ID: #1009174
Snippet name: Test Either (union type)
Eternal ID of this version: #1009174/1
Text MD5: f7b5067707e9b0106e76439f69b68820
Transpilation MD5: 204a6d5f4f4ed6b4f18783a877a93291
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-07-12 13:31:12
Source code size: 361 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 504 / 625
Referenced in: