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...


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.








Dec 16, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here