Question: Please help! Create a class, in a separate file, Generic Practice that has one generic types . M is a bounded type parameter; bounded by

 Please help! Create a class, in a separate file, Generic Practice

Please help!

Create a class, in a separate file, Generic Practice that has one generic types . M is a bounded type parameter; bounded by the class Number and interface Comparables. This class has two private data members: ArrayList list MinitVal You will need to include the following import statements in your .java file: import java.util.ArrayList; import java.util.Iterator; import java.util.LinkedList; import java.util.Collections; Provide a one argument constructor that takes a value and sets initVal with it as well as initializes the ArrayList with that value. Write the following public methods: void storeValue(M val) //this method will add val to the ArrayList void changeValue(M val, int index) //this method will replace the value at "index with "val. void printArray() //print out the values of the ArrayList using an iterator. Print "empty list if the list is empty. void sortPrintArray() //sort the values in the ArrayList and print using a for-each loop. void sortReversePrintArray() //sort ArrayList values in reverse order and print the values using a forEach method. void clearList() //clears the values in the ArrayList Hint: you can call methods from the ArrayList class and Collections to implement the above methods

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!