Do the same but more the kotlin way

This commit is contained in:
ligi 2016-10-28 15:21:04 +02:00
parent 3a11b6ae4e
commit 949e312a0f
No known key found for this signature in database
GPG key ID: 8E81894010ABF23D

View file

@ -7,12 +7,10 @@ class PassLocation {
var lat: Double = 0.toDouble() var lat: Double = 0.toDouble()
var lon: Double = 0.toDouble() var lon: Double = 0.toDouble()
fun getNameWithFallback(pass: Pass): String? { fun getNameWithFallback(pass: Pass) = if (name.isNullOrBlank()) {
if (name == null || name!!.isEmpty()) { // fallback for passes with locations without description - e.g. AirBerlin
// fallback for passes with locations without description - e.g. AirBerlin pass.description
return pass.description } else {
} name
return name
} }
} }