我正在使用矢量,当我复制数据并尝试对其进行编辑时,矢量和副本都发生了变化。
//The vectors contains int[] and the first 3 are loaded with int values.
int ToCheck[] = OpenSet.elementAt(Current);
ToCheck[1] = ToCheck[1] + 1; // This changes OpenSet and ToCheck[].
boolean IsInVector = false;
for(int y = 0;y < OpenSet.size(); y++){
if(ToCheck == OpenSet.elementAt(y)) // Because it changed both values it always is true
{
IsInVector == true;
}
}
我希望能够复制向量中的数据并在不更改原始数据的情况下对其进行编辑。