JAVA PROGRAMMING: Modify the following class to be a generic class. The generic
ID: 3666580 • Letter: J
Question
JAVA PROGRAMMING:
Modify the following class to be a generic class. The generic types usable by FilteredData should implement the Comparable interface. Your tester (whether it be a tester class with a main method or a JUnit class) should test your new FilteredData class with at least two different generic types, say String and Integer, for example.
import java.util.ArrayList;
public class FilteredData {
private ArrayList ds;
private Measurable min;
private Measurable max;
public FilteredData() {
ds = new ArrayList<>();
min = null;
max = null;
}
public void add(Measurable ele) {
if ((min == null) || (min.getMeasure() > ele.getMeasure())) {
min = ele;
}
if ((max == null) || (max.getMeasure() < ele.getMeasure())) {
max = ele;
}
ds.add(ele);
}
public Measurable getMin() {
return min;
}
public Measurable getMax() {
return max;
}
}