场景:我想对列表视图进行排序。我也有0.00 Mrp的项目。我有按MRP的顺序排列物品清单,按两倍排列。但我也必须在所有项目的底部显示带有0.00 Mrp的项目。
Collections.sort(productList, new Comparator<NewItemDataset>() {
@Override
public int compare(NewItemDataset lhs, NewItemDataset rhs) {
return lhs.getMrp().compareToIgnoreCase(rhs.getMrp());
}
});我正在使用上述代码进行排序。
有人能解决这个问题吗?
发布于 2016-07-15 07:28:03
试试这个:
Collections.sort(productList, new Comparator<NewItemDataset>() {
@Override
public int compare(NewItemDataset lhs, NewItemDataset rhs) {
return Double.compare(lhs.getMrp(), rhs.getMrp());
}
});https://stackoverflow.com/questions/38390234
复制相似问题