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).

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

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: 180 / 290
Version history: 7 change(s)
Referenced in: [show references]