Question: java language please Create a generic version of a Bag interface. This Bag interface will be a Generic interface with a Type Placeholder. Include the

java language please java language please Create a generic version of a Bag interface. This

Create a generic version of a Bag interface. This Bag interface will be a Generic interface with a Type Placeholder. Include the following methods in this Bag interface: int size() that returns a count of numbers in the bag boolean isEmpty ( ) - that checks if the bag is empty, returns true when empty void clear() - removes all the numbers from the bag int getFrequency (E e) - returns a count the number of times the number e exists in the bag boolean contains (E e) - Tests whether the bag contains the number e. Returns true when the e is contained in the bag. void add (E e) method that always add to the "next available" position. E remove (E e) method that removes the first occurrence of the number e in the container. Returns null ife is not in the Bag. E remove() method that removes a random entry from the list array. Returns the removed entry. Return nullif Bag is empty E get(int i) that returns the element at the ith index position in the list. String toString() - returns a String of the contents of the bag boolean equals (Object o) - returns a true if the parameter o exactly matches the contents of the bag (i.e. same elements in the same order) . . . in the

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!