Question: 2)- MyList Modification (Java) Modify the MyList class that you wrote for Programming Challenge 1 so that the type parameter T should accept any type
2)- MyList Modification (Java)
Modify the MyList class that you wrote for Programming Challenge 1 so that the type parameter T should accept any type that implements the Comparable interface. Test the class in a program that creates one instance of MyList to store Integers, and another instance to store Strings.
Mylist.java
import java.util.*; import java.math.BigDecimal; public class MyList
private ArrayList
}
public static void main(String args[]) { add(new BigDecimal(1)); add(new BigDecimal(5)); add(new BigDecimal(-1)); add(new BigDecimal(9)); System.out.println("Largest:"+list.Largest()); System.out.println("Lowest:"+list.Smallest()); } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
