Skip to content

Instantly share code, notes, and snippets.

@andrealaforgia
Last active July 31, 2020 00:34
Show Gist options
  • Save andrealaforgia/80ed8d0cf3640bf83ff1b9fc8a18e03d to your computer and use it in GitHub Desktop.
Save andrealaforgia/80ed8d0cf3640bf83ff1b9fc8a18e03d to your computer and use it in GitHub Desktop.
A generic BinaryTree class
public class BinaryTree<T> {
public static<T> BinaryTree<T> newTerminalNode(T nodeValue) {
throw new UnsupportedOperationException();
}
public static<T> BinaryTree<T> newNonTerminalNode(BinaryTree<T> leftTree, BinaryTree<T> rightTree) {
throw new UnsupportedOperationException();
}
public void visit(Consumer<BinaryTree<T>> consumer) {
throw new UnsupportedOperationException();
}
public boolean isTerminalNode() {
throw new UnsupportedOperationException();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment