Question: Code in Java. Using this interface: public interface MultiSet { void add(AnyType x); boolean contains(AnyType x); int count(AnyType x); boolean removeOne(AnyType x); boolean removeAll(AnyType x);
Code in Java.
Using this interface:
public interface MultiSet
void add(AnyType x);
boolean contains(AnyType x);
int count(AnyType x);
boolean removeOne(AnyType x);
boolean removeAll(AnyType x);
AnyType[] toArray(); }
Make a class called TreeMultiSet that implements the above interface with the methods (AnyType generic)
Inside the class use TreeMap as the data representation, and provide a toString method to print contents.
Also provide a runner class with main method that inserts and prints the contents of a sample TreeMultiSet object.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
