我有这堂课:
public class Turn {
public boolean turnMoved;
public int moveSelectionX;
public int moveSelectionY;
public int moveTargetX;
public int moveTargetY;
public boolean turnFired;
public int shotSelectionX;
public int shotSelectionY;
public int shotTargetX;
public int shotTargetY;
//Set this to true when doing a turn if we fired before moving
//Else if we do move/shot in the wrong order, we might select an empty cell
boolean firedFirst = false;
}
在我的程序的其他地方,我创建了这些对象的列表。列表完成后,我想按此顺序对列表进行排序,以便所有满足 1. 的对象都位于列表的前面,依此类推:
- turnMoved && turnFired == true
- 转身==真
- 转身 == 真
- turnMoved && turnFired == false
最简单的方法是什么?