dumptruckman
02/07/2019, 4:13 PMdumptruckman
02/07/2019, 4:13 PMadam-mcneilly
02/07/2019, 4:14 PMarekolek
02/07/2019, 4:14 PMdumptruckman
02/07/2019, 4:14 PMdumptruckman
02/07/2019, 4:15 PMvar recipients: MutableList<String> = mutableListOf()
var recipient: String
set(recipient: String) {
recipients.clear()
recipients.addAll(recipient.split(";"))
}
get() = recipients.joinToString(";")
dumptruckman
02/07/2019, 4:15 PMadam-mcneilly
02/07/2019, 4:16 PMrecipients = listOf(mySingleRecipient)
at the call site?adam-mcneilly
02/07/2019, 4:17 PMdumptruckman
02/07/2019, 4:17 PM=
i think for this to behave like a java builder patterndumptruckman
02/07/2019, 4:18 PMdumptruckman
02/07/2019, 4:19 PMRobert
04/09/2019, 8:11 PMgradle build
in my project in IntelliJ IDEA, it runs fine (errors, but nothing special). But when I try to run a test in that same project by click on the green run
-icon next to the test-method, it gives me this error: Error:java: javacTask: source release 8 requires target release 1.8
Seems like it runs JUnit tests not in the same way as gradle build? What should I change? I annotated it with @kotlin.test.Test
and have useJUnitPlatform()
in my gradle.build.kts in the test-section. How should I run tests fom IDEA?karelpeeters
04/09/2019, 8:48 PMcompileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
Robert
04/09/2019, 9:30 PMkotlin.test.*
or io.kotlintest.*
?Bas Dalenoord
04/10/2019, 8:16 AMresult.a
and result.b
remain uninitialized... Anyone with an idea?Bas Dalenoord
04/10/2019, 8:16 AMResult.a
and Result.b
to be the same as toMap.a
and toMap.b
Smallville7123
04/10/2019, 11:18 AM/**
* @sample foo
*/
fun a() {}
fun foo() {
val a: ArrayList<String>
}
will print
preprocessor.utils.core.classTools instanceChain.kt
public fun a(): Unit
Samples: foo
val a : ArrayList
Smallville7123
04/10/2019, 11:19 AMvar a: MutableList<B>
is making the rest of my function's text boldamadeu01
04/10/2019, 4:20 PMHullaballoonatic
04/10/2019, 5:52 PMoperator fun List<Int>.get(range: IntRange) = subList(range.start, range.endInclusive - 1)
val foo = listOf(1,2,3,4)
val bar = foo[0..2] // [1,2,3]
But I think foo[1..]
and foo[..3]
would be great too, even though you can accomplish them each with a single list method, this looks nicer imo
That would require the rangeTo
operator to create unbounded ranges, though, but I think it'd be nice to have that, too.
Thoughts?Hullaballoonatic
04/10/2019, 5:55 PMkarelpeeters
04/10/2019, 5:58 PMobject Ellipsis
class SliceUntil(val index: Int)
class SliceFrom(val index: Int)
operator fun Ellipsis.rangeTo(index: Int) = SliceUntil(index)
operator fun Int.rangeTo(ellips: Ellipsis) = SliceFrom(index)
operator fun <T> List<T>.get(slice: SliceUntil): List<T> = ...
operator fun <T> List<T>.get(slide: SliceFrom): List<T> = ...
list[Ellipsis..2]
list[2..Ellipsis]
karelpeeters
04/10/2019, 5:59 PMEllipsis
, maybe Edge
or something like that.ghedeon
04/10/2019, 6:01 PMkarelpeeters
04/10/2019, 6:02 PM[..2]
supposed to do? Isn't that just [0..2]
?Hullaballoonatic
04/10/2019, 6:02 PMHullaballoonatic
04/10/2019, 6:03 PM[1..]
Hullaballoonatic
04/10/2019, 6:03 PM[:]
with [..]
user
04/11/2019, 8:00 AMwhen
statements as expressions. They offer a series of benefits, including a check for exhaustiveness #KotlinTips https://t.co/GQROGKo7Fh https://t.co/KfXsdTLADw
Twitter