Mateus Andrade
10/17/2018, 2:27 PMcjmartinkoski
10/17/2018, 4:21 PMNikky
10/17/2018, 5:18 PMjw
10/17/2018, 7:11 PMpavel
10/17/2018, 10:12 PMHamza
10/18/2018, 12:03 AMVladyslav Sitalo
10/18/2018, 9:08 AMlateinit
does not work with the basic types (e.g. `Int`/`Long`/etc)? Googling tells me that it’s because of the way kotlin represents those types, but It’s still fuzzy for me. So I’d appreciate a link or an explanation 🙂lukaswelte
10/18/2018, 9:15 AMrunCatching
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/run-catching.html is in the API docs as there since version 1.0 for JVM.
I use (Java 8 Maven project)
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
<version>1.2.71</version>
</dependency>
But it does not contain the function (IntelliJ won’t find it).
Is that a documentation bug, or do I need to import the stdlib in another way?Jukka Siivonen
10/18/2018, 11:57 AMfun localDateFormatter(): Formatter<LocalDate> {
return object : Formatter<LocalDate> {
override fun parse(text: String, locale: Locale): LocalDate {
return LocalDate.parse(text, DateTimeFormatter.ISO_DATE)
}
override fun print(obj: LocalDate, locale: Locale): String {
return DateTimeFormatter.ISO_DATE.format(obj)
}
}
}
pp.amorim
10/18/2018, 1:15 PMSiebelsTim
10/18/2018, 1:32 PM-Xno-param-assertions
does pretty much exactly what you want. I don't know if the performance impact is really relevant thoughAzMoo
10/19/2018, 1:27 AMdata class FleetUnitJson(
val id: Int,
val stock_no: String,
val children: List<FleetUnitJson>
)
data class FleetUnit(
val id: Int,
val stock_no: String
)
How can I create a FleetUnit from a FleetUnitJson? I can pass all the properties to the constructor of course but I thought there might be an easier way.Hullaballoonatic
10/19/2018, 2:49 AMHullaballoonatic
10/19/2018, 2:51 AMHullaballoonatic
10/19/2018, 2:56 AMursus
10/19/2018, 3:24 AMHullaballoonatic
10/19/2018, 4:22 AMursus
10/19/2018, 4:23 AMHullaballoonatic
10/19/2018, 4:23 AMHullaballoonatic
10/19/2018, 5:25 AMlynas
10/19/2018, 5:26 AMahulyk
10/19/2018, 7:59 AMkotlin {
experimental {
newInference = "enable" //this does not compile
}
}
because ExperimentalExtension is missing newInference variable
org.jetbrains.kotlin.gradle.dsl.ExperimentalExtension:
open class ExperimentalExtension {
var coroutines: Coroutines? = null
}
Filip Husnjak
10/19/2018, 9:13 AMHexa
10/19/2018, 9:16 AM@Throws(NoSuchAlgorithmException::class)
private fun generateKeyPair(): KeyPair {
}
Tsvetozar Bonev
10/19/2018, 11:33 AMStrum355
10/19/2018, 12:23 PMboth functions of type Cat -> Cat and Animal -> Animal can be used wherever a Cat -> Animal was expected.
. Ik its not strictly kotlin related, but kotlin does have the in-out keywords.sbyrne
10/19/2018, 2:12 PMgabrielfv
10/19/2018, 3:22 PMfun method(obj: Class) { //... }
2️⃣ (Will do nothing when obj
is null)
fun method(obj: Class?) {
if (obj == null) return
// ...
}
3️⃣ (Behaves like 2, assignment notation also applies method(...) = obj?.let{
, which may be seen as better alternative?)
fun method(obj: Class?) {
obj?.let {
// Wraps whole method around this block, up to 10 lines of code
}
}
gabrielfv
10/19/2018, 3:22 PMalisidhu
10/20/2018, 4:44 AMalisidhu
10/20/2018, 4:44 AMHamza
10/20/2018, 4:45 AMShawn
10/20/2018, 4:45 AMalisidhu
10/20/2018, 4:47 AMorangy
10/20/2018, 4:59 AMalisidhu
10/20/2018, 5:14 AM