How do I achieve setting the value inside if else in one line?
String amount = myJSON.optString("cValue")
double cValue = (amount != null && !amount.isEmpty()) ? Double.parseDouble(amount) : 0;
if (cValue > 0) {
mySavings.setCouponValue(cValue);
} else {
mySavings.setCouponValue(0.0);
}
Aucun commentaire:
Enregistrer un commentaire