上我有以下类型的ArrayList列表。如果未设置,则to属性将为-1。我有以下数组:Java的排序基于另一个列表
int[][] history = new int[50][50];
其中尺寸对应于移动类的'from'和'to'。在我的搜索功能,并根据一定的条件,我需要做:
List<move> moves = board.getMoves();
for (int i = 0; i < moves.size(); i++)
history[move.from][move.to]++;
因为move.to也可能是-1,我应该增加二维数组1的尺寸,然后做:
history[move.from+1][move.to+]++;
此外,根据上述移动列表和历史数组,我需要根据相应历史索引的计数器以降序对移动列表进行排序。
这可能吗?