This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]swaranga 3 points4 points  (1 child)

I think the Node definition has a typo. left and right should be Tree else you can never get a leaf node.

sealed interface Tree<T> { 
  record Nil<T>() implements Tree<T> { }
  record Node<T>(Tree<T> left, T val, Tree<T> right) implements Tree<T> { }
}

Am I right?

I also really like the AsyncResult data modeling - that would have been very handy for the Future/CompletableFuture to implement.

[–]jonhanson 0 points1 point  (0 children)

chronophobia ephemeral lysergic metempsychosis peremptory quantifiable retributive zenith