public class Demo06 {
public static <E extends Comparable<E>> E max(E[]list){
E max;
if(list==null)
return null;
else {
max = list[0];
}
for(E t:list){
if(t.compareTo(max)>0)
max = t;
}
return max;
}
}
public class Demo07 {
public static <E extends Comparable<E>> int linearSearch(E[] list,E key){
if(list==null) return -1;
for (int i=0;i<list.length;i++)
if(list[i].equals(key))
return i;
return -1;
}
}