Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class TreeNode<T> {
- private T value;
- private TreeNode left, right;
- public TreeNode(T value) {
- this.value = value;
- this.left = null;
- this.right = null;
- }
- public TreeNode(T value, TreeNode left, TreeNode right) {
- this.value = value;
- this.left = left;
- this.right = right;
- }
- public void setValue(T newValue) {
- this.value = newValue;
- }
- public void setLeft(TreeNode left) {
- this.left = left;
- }
- public void setRight(TreeNode right) {
- this.right = right;
- }
- public T getValue() {
- return this.value;
- }
- public TreeNode getLeft() {
- return this.left;
- }
- public TreeNode getRight() {
- return this.right;
- }
- } // end of class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement