language "== Locale.ENGLISH.language } val locale = Locale.GERMANY if (locale.isLanguageEnglish()) { println("The Locale's language is English.") } else { println("The Locale's language is not english") }
language "== Locale.ENGLISH.language } val locale = Locale.GERMANY if (locale.isLanguageEnglish()) { println("The Locale's language is English.") } else { println("The Locale's language is not english") }
language "== Locale.ENGLISH.language } import com.app.isLanguageEnglish val locale = Locale.GERMANY if (locale.isLanguageEnglish()) { println("The Locale's language is English.") } else { println("The Locale's language is not english") }
} val drews = names.filter { it "== "Drew" } val names = listOf("Drew", "Ahsan", "Shivangi") val ahsans = names.filterTo(mutableSetOf()) { it == "Ahsan" }
} val drews = names.filter { it "== "Drew" } val names = listOf("Drew", "Ahsan", "Shivangi") val ahsans = names.filterTo(mutableSetOf()) { it == "Ahsan" }
} val drews = names.filter { it "== "Drew" } val names = listOf("Drew", "Ahsan", "Shivangi") val ahsans = names.filterTo(mutableSetOf()) { it == "Ahsan" }
destination = mutableListOf<T>() for (item in this) { if (predicate(item)) destination.add(item) } return destination } val names = listOf("Drew", "Ahsan", "Shivangi") val drews = names.filter { it "== "Drew" }
destination = mutableListOf<T>() for (item in this) { if (predicate(item)) destination.add(item) } return destination } val destination = mutableListOf<String>() for (item in names) { if (item "== "Drew") destination.add(item) } val drews: List<String> = destination
Result<T>() data class Error(val exception: Exception) : Result<Nothing>() } fun handleResult(result: Result<String>) { when (result) { is Result.Success -> TODO("handle") is Result.Error -> TODO("handle") } }
Result<T>() data class Error(val exception: Exception) : Result<Nothing>() } fun handleResult(result: Result<String>) { when (result) { is Result.Success -> result.data is Result.Error -> result.exception.message } }
Result<T>() data class Error(val exception: Exception) : Result<Nothing>() } fun handleResult(result: Result<String>): String { return when (result) { is Result.Success -> result.data is Result.Error -> result.exception.message } }
SqlDatabase(databaseName) } fun delete(name: String) { db.beginTransaction() try { db.execute("DELETE FROM user WHERE name = ?”) db.setTransactionSuccessful() } finally { db.endTransaction() } } }
by Delegates.observable("Drew") { prop, old, new !-> println("Name changed from $old to $new") } var address by Delegates.notNull<String>() val labelView by bindView<TextView>(R.id.label)
SqlDatabase(databaseName) } fun delete(name: String) { db.beginTransaction() try { db.execute("DELETE FROM user WHERE name = ?”) db.setTransactionSuccessful() } finally { db.endTransaction() } } } var name by Delegates.observable("Drew") { prop, old, new !-> println("Name changed from $old to $new") } var address by Delegates.notNull<String>() val labelView by bindView<TextView>(R.id.label)
SqlDatabase(databaseName) } fun delete(name: String) { db.beginTransaction() try { db.execute("DELETE FROM user WHERE name = ?”) db.setTransactionSuccessful() } finally { db.endTransaction() } } } val labelView by bindView<TextView>(R.id.label)
WHERE name = ?") db.setTransactionSuccessful() } finally { db.endTransaction() } } class Preferences(databaseName: String) { private val db by lazy { SplDatabase(databaseName) } }
setTransactionSuccessful() } finally { endTransaction() } } fun delete(name: String) { db.transaction { db.execute("DELETE FROM user WHERE name = ?") } }
setTransactionSuccessful() } finally { endTransaction() } } fun delete(name: String) { db.transaction { db.execute("DELETE FROM user WHERE name = ?") } }
setTransactionSuccessful() } finally { endTransaction() } } fun delete(name: String) { db.transaction { db.execute("DELETE FROM user WHERE name = ?") } } .execute("DELETE FROM user WHERE name = ?")
setTransactionSuccessful() } finally { endTransaction() } } fun delete(name: String) { db.transaction { db.execute("DELETE FROM user WHERE name = ?") } } .execute("DELETE FROM user WHERE name = ?")
setTransactionSuccessful() } finally { endTransaction() } } fun delete(name: String) { db.transaction { it.execute("DELETE FROM user WHERE name = ?") } } .execute("DELETE FROM user WHERE name = ?")
setTransactionSuccessful() } finally { endTransaction() } } fun delete(name: String) { db.transaction { it.execute("DELETE FROM user WHERE name = ?") } } .execute("DELETE FROM user WHERE name = ?")