我想从 2D arraylist 中删除特定行,并且该行被下一行替换。我写了以下代码:
Collection<?> c = joint_mat.get(row);
joint_mat.get(row).removeAll(c);
此代码正在删除该行的元素,但不将其替换为下一行。输出如下:
[0.6, 0.608, 0.608, 0.628, 0.608],
[0.6, 0.6, 0.6, 0.608, 0.608],
[0.6, 0.652, 0.6, 0.612, 0.608],
[],
[0.612, 0.632, 0.608, 0.604, 0.608],
[0.6, 0.604, 0.604, 0.62, 0.62],