オブジェクト 'CharacterMove' の ArrayList を正しく反復していない for-each ループを取得しました。反復する直前に size() を印刷しようとしたので、空ではないことはわかっています
これが私が持っているfor-eachです
for (CharacterMove move : charinfo.getMoves()) {
ArrayList
private List<CharacterMove> moveset = new ArrayList<>();
誰?
編集:これが完全な方法です
public static void writeDataFromChara(CharacterInfo charinfo, String fileTarget, boolean popupFail) {
try {
File file = new File(fileTarget);
PrintStream ps = new PrintStream(file);
ps.print("<INFO>");
ps.println();
System.out.println("Size: " + charinfo.getMoves().size());
//Write the information
for (Entry<String, String> entry : charinfo.tree.getAllDatas().entrySet()) {
ps.print(entry.getKey() + ":" + entry.getValue());
ps.println();
}
//Write the moves, frames and hitboxes
for (CharacterMove move : charinfo.getMoves()) {
System.out.println("Z"); //Never called just like everything else
ps.print(move.name + ":");
ps.println();
for (Pair<CharacterMoveFrame,Integer> frame : move.frames) {
ps.print("frame:"); //Indicate that this is part of a new frame
for (Entry<String, Collider> collider : frame.left.hitboxes.entrySet()) {
ps.print(collider.getValue().x + ",");
ps.println();
ps.print(collider.getValue().y + ",");
ps.println();
ps.print(collider.getValue().w + ",");
ps.println();
ps.print(collider.getValue().h);
ps.println();
}
}
}
ps.close();
} catch (IOException e0) {
if (popupFail) {
JOptionPane.showMessageDialog(new JPanel(), "An error happened while writing the data", "Error", 1);
}
}
}