I tried to implement a BST class was like
class BST<T> {
private Node<T> root;
private static class Node<T> {
T element;
Node<T> left;
Node<T> right;
}
}
I want to get the successor node in a method which takes a Node as a parameter and returns a successor node
private <T> Node<T> get(Node<T> current node){
Node<T> successor = root;
}
here I'm getting incompatible types . if I remove the method bound
private Node<T> get(Node<T> current node) {
Node<T> successor = root;
}
now it is compiling fine. What is the reason?