I'm having trouble working with generics. I have a class as
public class findMinMax<T extends Comparable <T>> {
private T min;
private T max;
public findMinMax() {
//Need to initialize min max to something so that I can compare them
}
public void find(T value) {
if (min == null || min.compareTo(value) > 0)
min = value;
if (max == null ||value.compareTo(max) > 0)
max = value;
}
}
So how can you initialize a generic variable? Thanks