I have some classes and I have converted them from Java to Kotlin.
This is the Kotlin method:
private var allCountriesList: List<Country>? = null
val allCountries: List<Country>
get() {
val locales = Locale.getISOCountries()
val countries = ArrayList<Country>()
for (countryCode in locales) {
val obj = Locale("", countryCode)
Log.i("AMIRA2020", obj.country + " / " + obj.displayName)
if (obj.country == "SP" == false && obj.country == "ZG" == false)
countries.add(Country(obj.country, obj.displayName, -1))
}
Collections.sort(countries) { o1, o2 -> o1.name!!.compareTo(o2.name!!) }
allCountriesList = countries
return allCountriesList
}
I am getting an error in the return
statement that the smart case is impossible.
Can anyone help please ?