有谁知道如何根据“任务”的两个属性“p_t”和“weight”的乘法对“serviceNeedingTasks”进行排序?它似乎不正确,因为它只是基于“p_t”排序。
Collections.sort(serviceNeedingTasks, new Comparator<Tasks>() {
public int compare(Tasks c1, Tasks c2) {
if (c1.p_t)*(c1.weight) > (c2.p_t)*(c1.weight) return -1;
if (c1.p_t)*(c1.weight) < (c2.p_t)*(c1.weight) return 1;
return 0;
}});