Mark
09/13/2020, 11:30 AMclass MyClass {
fun String.myFun() {
myFun() // how to invoke top-level extension function instead of itself?
}
}
fun String.myFun() {
...
}
ken_kentan
09/14/2020, 9:18 AM"AAA{foo}BBB{bar}CCC"
to ["AAA", "{foo}", "BBB", "{bar}", "CCC"]
if regex is \{.*?}
keishi kubo
09/14/2020, 4:36 PMkeishi kubo
09/14/2020, 4:48 PMharry.singh
09/14/2020, 6:18 PMval myMap = mutableMapOf<Foo, Int>()
. When I try to update the map with some integer values(for e.g. myMap[Foo] = 3
), it is giving me the following error:
RequiredWhy am I getting this error and how can I resolve it?but foundInt.Companion
Int
Steven Wang
09/14/2020, 10:49 PMfun simulate() {
// get only regular session and it's
val sessionSelectedSymbols = toSelectedSymbols(scanResults).filter {
market.calendar.sessions.find { it.sessionId == it.sessionId }!!.regular
}
val targets = groupBySymbol(sessionSelectedSymbols).toMap()
runBlocking {
withContext(Dispatchers.Default) {
targets.toList().map { launch { runSymbol(it) } }
}
}
// will the tasks all finished when call to simulate() returns? or I have to call join on each launched tasks?
}
Not Me
09/15/2020, 7:44 PMSteven Wang
09/15/2020, 8:39 PMDoug
09/18/2020, 4:32 AMClassA
and only override a specific function in ClassB
, is there anyway to do that, or do I need to ensure all of the methods require are created?
interface View {
fun loadFirstPage()
fun otherFunction()
}
open class ClassA: View {
override fun loadFirstPage() { ... }
override fun otherFunction() { ... }
}
class ClassB: ClassA() {
override fun loadFirstPage() { ... }
}
when I load ClassB
, I’m only seeing the code from ClassA
be executedEsa
09/18/2020, 9:16 AMKFunction<*>
? I've got a weird situation where kfunction.javaClass.enclosingClass.simpleName works in one situation, but not another situation.John Guerra
09/18/2020, 9:32 PMoverride fun onEnable() {
plugin.server.onlinePlayers.forEach(::join)
}
Rather than
override fun onEnable() = plugin.server.onlinePlayers.forEach(::join)
vlad.minaev
09/19/2020, 8:52 AMJohn Guerra
09/20/2020, 1:59 AMJohn Guerra
09/20/2020, 4:59 PMinternal abstract val packetTypes: List<KClass<*>>
Cause there's times where it'd look like this:
override val packetTypes = listOf(
PacketPlayInFlying::class,
PacketPlayInFlying.PacketPlayInPosition::class,
PacketPlayInFlying.PacketPlayInPositionLook::class,
PacketPlayInFlying.PacketPlayInLook::class
)
Which honestly isn't always very pretty to look at. If I only add PacketPlayInFlying::class
to the list then the other classes won't be retrieved. I have to manually add each one so they can be detected.Slackbot
09/20/2020, 9:21 PMDaniele B
09/22/2020, 7:26 PMchanged
twice ?
val changed = changeSelectedCounty()
if (changed) {
showDetail()
}
I am looking for something like this, but it’s not accepted:
if (val changed = changeSelectedCounty()) {
showDetail()
}
I would to assign the result to the changed
variable, as it gives more clarityAlexander Schell
09/23/2020, 4:57 AMAshish Lama
09/23/2020, 1:23 PMWavecycle
09/23/2020, 2:24 PMclass Leetspeak : Encoder() {
private val leetChars = mapOf<String, String>("a" to "4", "e" to "3", "l" to "1",
"m" to "/^^\\", "o" to "0", "u" to "(_)")
override fun encode(source: String?): String {
return if (source.isNullOrEmpty()) ""
else source.map { it: Char -> leetChars.get(it) ?: it.toString() }
.joinToString("")
}
}
Matt Hicks
09/23/2020, 7:35 PMAmir Eldor
09/23/2020, 8:14 PMSteven Wang
09/24/2020, 1:33 PM`listOf("A" to 1, "B" to 2, "C" to 1)` to `mapOf(1 to listOf("A", "C"), 2 to listOf("B"))`
Mark
09/25/2020, 4:46 AM::emit
)?
suspend fun FlowCollector<Something>.emitNotNull(something: Something?) {
something?.let { emit(it) }
}
Esa
09/27/2020, 12:15 PMGrian
09/29/2020, 12:46 PMkotlin.test.assertEquals
a list of valid expected outputs, like can i just pass it a list and if the output of whatever im testing is part of that list itll say the test passed?Pau
09/29/2020, 7:21 PMDaniele B
09/29/2020, 11:30 PMList<DataA>
and List<DataB>
starting from a List<Source>
?
data class Source {
val label
val valueA
val valueB
}
data class DataA {
val label
val valueA
}
data class DataB {
val label
val valueB
}
Mike Conley
10/01/2020, 4:59 PMColton Idle
10/02/2020, 2:31 AMVikas Singh
10/02/2020, 5:48 AM