0
Ürünlerini Düşükten Yüksek'e Düşük & Düşük Fiyatına Yüksek Düzeyde sıralamam gerekiyor.Aşağıdaki kodu kullanarak Alçaktan Yüklemeyi bitirdim.Yüksek Düşük'yi nasıl uygulayacağımı bilmiyor musunuz?Listenin Sıralaması <Object>
Yanıtınız daha takdir... ifadeyi
public static Comparator<Restaurant_Beam> strPriceFilterL2H = new Comparator<Restaurant_Beam>() {
@Override
public int compare(Restaurant_Beam lhs, Restaurant_Beam rhs) {
int CompareResult = 0;
if (Config.L2HFilterClicked == "L2H") {
CompareResult = (int) Math.round(Double.parseDouble(lhs.getIG_SALES_PRICE()) - Double.parseDouble(rhs.getIG_SALES_PRICE()));
}
//Used else if for H2L.But did not get it as perfect
else if (Config.L2HFilterClicked == "H2L") {
CompareResult = (int) Math.round(Double.parseDouble(lhs.getIG_SALES_PRICE()) + Double.parseDouble(rhs.getIG_SALES_PRICE()));
}
return CompareResult;
}
};
Teşekkürler Çok @van Leonenko –