Last active
October 16, 2020 08:49
-
-
Save rooparsh/829a32a755b45f6cf7ca90379c18d26d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun getCountries(): Map<String, String> { | |
val countriesMap = hashMapOf<String, String>() | |
val isoCountries = Locale.getISOCountries() | |
isoCountries.forEach { | |
val locale = Locale("", it) | |
countriesMap[locale.country.toLowerCase(Locale.getDefault())] = locale.displayCountry | |
} | |
return countriesMap.toList().sortedBy { (_, value) -> value }.toMap() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment