when I try to compile my file, I got these errors:
invalid method declaration; return type required public get(int i) throws SortingException{
invalid method declaration; return type required public set(int i, T elem) throws SortingException {
here are my methods:
public static <T extends Comparable<T>> ArrayList<T> insertionSort(ArrayList<T> list, int ordinamento){
ArrayList<T> listaOrdenada;
listaOrdenada = new ArrayList<T>(list);
for(int x = 1 ; x < listaOrdenada.size(); x++){
T aux = listaOrdenada.get(x);
int y = x - 1;
while(y >= 0 && aux.compareTo(listaOrdenada.get(y)) < 0){
listaOrdenada.set(y + 1, listaOrdenada.get(y));
y--;
}
listaOrdenada.set(y + 1, aux);
}
return listaOrdenada;
}
public <T> set(int i, T elem) throws SortingException {
if(i<0 || i>=(this.array).size()) throw new SortingException("ERRORE!");
return (this.array).set(i, elem);
}
public <T> get(int i) throws SortingException{
if(i<0 || i>=(this.array).size()) throw new SortingException("ERRORE!");
return (this.array).get(i);
}