我想更新 Play 商店中应用程序的版本,但在测试中我开始收到此错误。
Superclass androidx.core.app.f of androidx.activity.ComponentActivity is declared final
Run Code Online (Sandbox Code Playgroud)
根据谷歌问题跟踪器,这是新的,也许有人有解决这个问题的方法。
我想创建一个类似 Kotlin 的 ifEmpty() 的函数,它也会检查 null:
ifNullOrEmpty{
//some code if null or empty
}
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点?
有谁知道下面的代码叫什么?
: R where C : CharSequence, C : R
Run Code Online (Sandbox Code Playgroud)
Kotlin ifEmpty() 函数的示例。
@SinceKotlin("1.3")
@kotlin.internal.InlineOnly
public inline fun <C, R> C.ifEmpty(defaultValue: () -> R): R where C : CharSequence, C : R =
if (isEmpty()) defaultValue() else this
Run Code Online (Sandbox Code Playgroud)
感谢,并有一个愉快的一天!