Collections.sort(list, new Comparator<Object>() {
@Override
public int compare(Object o1, Object o2) {
if (o1.getP() > o2.getP()) {
return -1;
} else if (o1.getP() < o2.getP()) {
return 1;
} else {
return 0;
}
}
});
Collections.sort(list, new Comparator<Object>() {
@Override
public int compare(Object o1, Object o2) {
if (o1.getP() > o2.getP()) {
return -1;
} else if (o1.getP() < o2.getP()) {
return 1;
} else {
return 0;
}
}
});