randomcat
03/08/2020, 5:16 PMHullaballoonatic
03/08/2020, 6:29 PMList
and Array
in Kotlin? Or Array<Double>
and DoubleArray
? Meaning when should you use one or the other, not what they literally are in terms of blocks of memory or the like.Chills
03/08/2020, 7:29 PMChills
03/08/2020, 7:30 PMChills
03/09/2020, 3:34 AMPeyton
03/09/2020, 5:32 AMDragan Stanojević - Nevidljivi
03/09/2020, 7:00 AMDave Jensen
03/09/2020, 7:01 AMHeaders
, in a dozen or more packages but they do not implement an interface and all extend Object. I’ve struggling to come up with a solution that keeps the code DRY.Mark
03/09/2020, 10:14 AMoverride val myVal = null
or override val myVal get() = null
Tim
03/09/2020, 1:07 PMString.trim()
and im just curious, why the cast to CharSequence?
/**
* Returns a string having leading and trailing whitespace removed.
*/
@kotlin.internal.InlineOnly
public inline fun String.trim(): String = (this as CharSequence).trim().toString()
William Skinner
03/09/2020, 9:32 PMdata class File(val state: String, val integrationId: Int, val archiveId: String, val sysTag: String, @field:JsonSerialize(using = ToStringSerializer.class) val _id: ObjectId = ObjectId())
aeruhxi
03/10/2020, 7:43 AMj_recuerda
03/10/2020, 9:01 AMthana
03/10/2020, 10:21 AMMap<KClass<out SomeClass>, KSerialzier<out SomeClass>
is there a way to make sure both generic types refer to the same type analogous to java e.g. https://www.informit.com/articles/article.aspx?p=2861454&seqNum=8user
03/10/2020, 10:30 AMStephan Schroeder
03/10/2020, 12:03 PMval sClass: KClass = String::class
gives me the KClass
for String
, how do I get the KClass
for String?
?
I tried
val nsClass: KClass = String?::class
but that doesn’t compile.Guy Bieber
03/10/2020, 1:39 PMOrhan Tozan
03/10/2020, 10:17 PMawaitAll()
I need something like awaitAllFirstFinished()
Tia Petts
03/11/2020, 12:43 AMMark
03/11/2020, 5:12 AMfun myFun(vararg ps: MyParam1)
and fun myFun(vararg ps: MyParam2)
and we have a call like myFun(*emptyArray<MyParam1>())
then AndroidStudio will give the warning Remove redundant spread operator
which is wrong because it is not redundant (and indeed myFun()
will give a compilation error).Sagar Suri
03/11/2020, 5:13 AMbetterclever
03/11/2020, 5:43 AMMarc Knaup
03/11/2020, 7:54 AMbetterclever
03/11/2020, 12:22 PMChills
03/11/2020, 4:39 PMChills
03/11/2020, 5:00 PMGuy Bieber
03/11/2020, 6:12 PMabstract class Parent {
init {
print("Parent Init: ")
var str = getString()
println(" $str")
}
constructor () {
print("Parent Constructor: ")
var str = getString()
println(" $str")
}
protected abstract fun getString () : String
}
class Child : Parent {
var myString : String = "test"
init {
print("Child Init: ")
var str = getString()
println("$str")
}
constructor () {
print("Child Constructor: ")
var str = getString()
println("$str")
}
override fun getString() : String {
return myString
}
}
var child : Child = Child()
println("Main: ${child.myString}")
Example output
Parent Init: null
Parent Constructor: null
Child Init: test
Child Constructor: test
Main: test
Guy Bieber
03/11/2020, 8:37 PMmolikuner
03/11/2020, 9:19 PMval x = listOf("a", "a", "b").function(listOf("a", "c"))
where
x == listOf("a", "b")
When using
listOf("a", "a", "b") - listOf("a", "c")
I get
x == list("b")
but I want to have one a
in there.
I know that I could do:
var a = listOf("a", "a", "b")
val b = listOf("a", "c")
b.forEach {
a = a - it
}
But I don’t really like the forEach
and var
in that solution.Gus
03/11/2020, 10:23 PM