Reputation: 1343
I have the following class :
public class BinarySearchTree<Key extends Comparable<? super Key>, E>
{
private BTNode<Key, E> root;
int nodeCount;
/* Constructor */
public BinarySearchTree()
{
this.root = null;
this.nodeCount = 0;
}
...
I have no idea how to create an instance of it in my application though...
I have tried :
BinarySearchTree myTree = new BinarySearchTree();
and also,
BinarySearchTree<Integer> myTree = new BinarySearchTree<Integer>();
Any ideas are greatly welcomed!
Upvotes: 1
Views: 609
Reputation: 72854
Your BinarySearchTree
has two type variables in it: one called Key
for the comparable key, and one called E
for the type of the node content. You're specifying just one type argument in the variable declaration:
BinarySearchTree<Integer, MyType> myTree = new BinarySearchTree<Integer, MyType>();
Upvotes: 1