public static List<double[]> pc = new LinkedList();
public void fillTable1() {
int index = getWorstI();
double[] temp = pc.get(index);
for(int n=0;n<4;n++)
System.out.println( temp[n]);
for(int i=0;i<4;i++)
{
for(int j=0;j<4;j++)
(pc.get(i))[j]/=temp[j]; // values change only in object pc.get(1)! O_o
}
for(int i=0;i<4;i++)
Main.fillTheRow(table1, pc.get(i), i);
}
public static List<double[]> pc = new LinkedList(); public void fillTable1() { int index =
Share
It is assumed to be only pc.get(0) that the value is correctly changed.
The variable temp and pc.get(0) is reference to same object.
So the results of “(pc.get(0))[j]/=temp[j]” will be all “1”.
Therefor all the calculations after that become (pc.get(i))[j]/1 .
Change as follows not to become a reference.