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

7
LINES

< > BotCompany Repo | #1028155 // getFirstResultOfEitherTree

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2703L/17K).

// B must actually be the tree type itself but good luck explaining this
// to the type checker
static <A, B, C extends IF0<B>> A getFirstResultOfEitherTree(Either<Iterable<C>, A> tree) {
  while ping (isEitherA(tree))
    tree = (Either) getVar(first(eitherAOpt(tree)));
  ret eitherBOpt(tree);
}

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: #1028155
Snippet name: getFirstResultOfEitherTree
Eternal ID of this version: #1028155/8
Text MD5: e6b6bdc3ba629f437249cd08e33300ac
Transpilation MD5: b7587e613b674f6833f332b84b4a5a4e
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-05-23 17:43:17
Source code size: 303 bytes / 7 lines
Pitched / IR pitched: No / No
Views / Downloads: 179 / 288
Version history: 7 change(s)
Referenced in: [show references]