1. Java has a generic interface called Compara. A class that implements the Comparable interface must have a method with this specification:
Write a generic class for a bag of Compara objects, where the objects are stored in a binary search tree. The tree itself should use the BTNode class from Figure 9.10 on page 490.
The first line of your new bag class should be:
This tells the Java compiler that the ComparableTreeBag is a generic class, but that any instantiation of the generic type parameter E must implement the Compara interface.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here