Florian
09/12/2019, 7:27 AMUnit
the equivalent of Java's Void
rather than lowercase void
?spand
09/12/2019, 7:28 AMkarelpeeters
09/12/2019, 7:29 AMVoid
doesn't have an instance but it allows null
so that's kind of the single instance.Luca Nicoletti
09/12/2019, 7:31 AMRuckus
09/12/2019, 1:36 PMVoid
id equivalent to Kotlin's Nothing?
Luca Nicoletti
09/12/2019, 3:54 PMVoid?
Nothing
can’t return, only throws or keep workingRuckus
09/12/2019, 4:01 PMVoid
, that's from java. Nothing
can't return, but Nothing?
can return only null
, just like Java's Void
.Luca Nicoletti
09/12/2019, 4:02 PMUnit?
Ruckus
09/12/2019, 4:02 PMUnit?
can return Unit
or null
Luca Nicoletti
09/12/2019, 4:03 PMUnit
is mapped to Void
in JavaRuckus
09/12/2019, 4:05 PMUnit
is mapped to void
(lowercase) for return type in Java, but stays as Unit
in other circumstances, such as generics.Luca Nicoletti
09/12/2019, 4:06 PMUnit?
is mapped to?Ruckus
09/12/2019, 4:06 PMUnit?
Luca Nicoletti
09/12/2019, 4:07 PMRuckus
09/12/2019, 4:07 PMLuca Nicoletti
09/12/2019, 4:07 PMUnit?
in Java…..Ruckus
09/12/2019, 4:10 PMUnit
, but with Java;s implied nullability.Luca Nicoletti
09/12/2019, 4:10 PMRuckus
09/12/2019, 4:11 PM// Test.kt
fun test(): Unit? {
return null
}
// Test.java
TestKt.test(); // returns kotlin.Unit
Luca Nicoletti
09/12/2019, 4:12 PM