The declaration of a generic binary search tree class should declare the generic parameters, Key and Value, so that elements of type Key are comparable:
Non-static inner Node class
public class BST<Key extends Comparable<Key>, Value>
{
private Node root;
private class Node
{
private Key key;
private Value val;
private Node left;
private Node right;
public Node(Key k, Value v)
{
key = k;
val = v;
left = right = null;
}
public Node()
{
this(null);
}
}
}