Here are the Classes I'm using...
public class MyBinarySearchTreePlus<T extends KeyedItem<KT>, KT extends Comparable<? super KT>>
extends MyBinarySearchTree<T, KT> implements BSTPInterface<T, KT> {
public MyBinarySearchTreePlus() {
super();
}
}
.
public class MyBinarySearchTree<T extends KeyedItem<KT>, KT extends Comparable<? super KT>>
extends BinaryTreeBasis<T> {
public MyBinarySearchTree() {}
}
.
public abstract class BinaryTreeBasis<T> {
protected TreeNode<T> root;
public BinaryTreeBasis() {
root = null;
}
}
.
public abstract class KeyedItem<KT extends
Comparable<? super KT>> {
private KT searchKey;
public KeyedItem(KT key) {
searchKey = key;
}
}
Nothing I try will create a BinarySearchTree, I try:
MyBinarySearchTreePlus<Integer, Integer> tree = new MyBinarySearchTreePlus<Integer, Integer>();
I always get the error (coming from the first parameter):
Bound mismatch: The type Integer is not a valid substitute for the bounded
parameter <T extends KeyedItem<KT>> of the type MyBinarySearchTreePlus<T,KT>
What kind of Object is is T extends KeyedItem looking for? It doesn't compile with Comparable Objects, non-Comparable Objects, primitive Objects. So what exactly should I be using here? I don't understand why there's even 2 in the first place, obviously 1 is the type you are storing in the tree but whats's the other 1? I also have a TreeNode class of type T if that makes any difference.