2つのArrayList(sceneObjectsとanimationSceneObjects)を繰り返し処理し、名前フィールドに基づいて2つを一致させようとしています。ここに私のコードは次のとおりです。2つのArrayListをネストしたWhileステートメントで反復する - Java
Iterator<AnimationObject> itr = animationObjects.iterator();
Iterator<SceneObject> itrMain = sceneObjects.iterator();
while (itr.hasNext()) {
AnimationObject object = itr.next();
//Remove the word node from the animation object name so it matches main object name.
String tmpString = object.animationobjectName.replace("node-", "");
System.out.println("Animation Object name is" +tmpString);
while (itrMain.hasNext()) {
SceneObject objectMain = itrMain.next();
System.out.println("Scene Object name is" +objectMain.objectName);
if (tmpString.equals(objectMain.objectName)) {
System.out.println("Animation Object matched to main object array" +tmpString);
objectMain.animations = object.animationData;
objectMain.hasAnimations = true;
}
}
}
問題は、意図したとおりのコードが動作していないということである - それだけでitrMainイテレータの値にITRイテレータの最初の項目を比較します。
誰でも私が間違っているものを見つけることができますか?
ありがとうございます。
素晴らしい - ありがとうございます。 – GuybrushThreepwood