# ArrayList .set() method error -- need some help.

**807588**Feb 9, 2009 2:53 PM

I am doing an assignment about generic classes but when i compile this i get an error:

MyStatisticsClass.java:21: cannot find symbol

symbol : method set(int,double)

location: class java.util.ArrayList<T>

list.set(i, temp);

^

heres the code:

MyStatisticsClass.java:21: cannot find symbol

symbol : method set(int,double)

location: class java.util.ArrayList<T>

list.set(i, temp);

^

heres the code:

```
import java.util.*;
public class MyStatisticsClass<T extends Number>{
private ArrayList<T> list = new ArrayList<T>();
//private ArrayList<T> newList = new ArrayList<T>();
public MyStatisticsClass(ArrayList<T> data){
list = data;
}
public double standardDeviation(){
double temp;
double temp2;
//Get double value of all numbers.
for(int i = 0; i<list.size(); i++){
temp = list.get(i).doubleValue();
list.set(i, temp);
}
//Inside the square root
for(int i = 0; i<list.size(); i++){
temp = list.get(i).doubleValue();
temp =- this.average();
temp = temp * temp;
temp2 =+ temp;
}
temp = temp2/list.size();
//Square root and return
return Math.sqrt(temp);
}
public double average(){
double temp;
double num;
for(int i = 0; i<list.size(); i++){
temp =+ list.get(i).doubleValue();
num++;
}
return temp/num;
}
}
```

Any help on how to fix this.. i looked at the method and it looks like i have the right package imported and correct variable types for the index and data .. idk why it wont work. - 131 Views
- Tags: none (add)