Orderid Amount order id Amount
c4 1 c2 60
c2 10 c3 38
c2 20 c4 13
c2 30 null null
c3 11 null null
c3 13 null null
c3 14 null null
c4 12 null null
上記は 2 つの配列 (注文 ID、金額) です。最初の配列は、重複した注文 ID とその値を含む要素で構成されています。2 番目の配列に示すように、個別の注文 ID とその合計を見つけようとしています。そのために、以下のコードを書きました。動いていない 。助けてください
for(int y=0;y<data.length;y++) {
if(data[y][0].equals(data[y+1][0])==true)
{
tx=(Double) data[y][1]+(Double)data [y+1][1];
data[y+1][1] = tx;
data[y][1]=tx;
data[y][0]=null;
}
if(y+1 > data.length)
{
break;
}
System.out.println("Tx="+tx);
}