Bruno Medeiros
02/26/2021, 12:51 AMA new version 203-1.4.31-release-IJ7148.5 of the Kotlin plugin is available.Couldn't find any release notes on Kotlin 1.4.31 (searched on Google and checked here), am I missing somehing?
Paul Woitaschek
02/26/2021, 6:37 AMDominick
02/26/2021, 7:20 AMprivate const val WORD_PATTERN = """[A-Za-z][A-Za-z']*"""
private val WORD_REGEX = Regex(WORD_PATTERN)
fun top3(s: String): List<String> {
val words = WORD_REGEX.findAll(s).map{ it.groupValues[0].toLowerCase() }
val occurrences = mutableMapOf<String, Int>()
for (word in words) {
occurrences[word] = (occurrences[word] ?: 0) + 1
}
return occurrences.toList()
.sortedByDescending{ it.second }
.map{ it.first }
.take(3)
}
Alexander Karkossa
02/26/2021, 11:59 AMRob Elliot
02/26/2021, 2:52 PMpeekandpoke
02/26/2021, 2:53 PMwhen() { is .. }`
I have a when and i am covering all sub-classes of a sealed class, still the IDE shows me an error. The compiler is fine with the code?
I have the newest plugin 1.4.31 and the kotlin version of the project is 1.4.31 as well. Gradle 6.8.1 ... any thoughts?CLOVIS
02/26/2021, 7:10 PMbsimmons
02/26/2021, 8:14 PMKarlo Lozovina
02/27/2021, 12:08 AMuser
02/27/2021, 5:20 PMjacksparling
02/28/2021, 12:47 PMShivam Sethi
02/28/2021, 7:20 PMtherealbluepandabear
03/01/2021, 12:10 AMtherealbluepandabear
03/01/2021, 3:57 AMAbhishek K
03/01/2021, 12:51 PMChills
03/01/2021, 10:30 PMtherealbluepandabear
03/02/2021, 5:25 AMviralshah
03/02/2021, 7:06 AMval myList = (1..100).toList().chunked(5) -> gives me the right answer
val result = (1..45).toList().chunked(5)) -> gives me only 9 chunks
Is it possible to add empty lists for the remaining 11 chunks?Conor Fennell
03/02/2021, 12:43 PMclass Container<in T>(private val t: T)
open class Noun
open class City: Noun()
class Capital: City()
fun goCity(container: Container<City>) {
println(container)
}
fun main() {
goCity(Container(Noun())) // pass in a super type of City, this is what I would expect as it is defined contravariance
goCity(Container(Capital())) // pass in a sub type of City, would not have expected this as it is defined contravariance
}
Luciano
03/02/2021, 12:47 PMtest
task rather then executing the test directly (like in a Java project). Is there a way to run the test directly in Intellij?Luciano
03/02/2021, 5:48 PMTianyu Zhan
03/02/2021, 6:54 PMtherealbluepandabear
03/03/2021, 3:20 AMtherealbluepandabear
03/04/2021, 12:24 AMtherealbluepandabear
03/04/2021, 12:27 AMRobert MacLean
03/04/2021, 8:47 AMxii
03/04/2021, 12:54 PMSirNapkin1334
03/04/2021, 5:44 PMexpect class
, how would one go about adding functionality to it? say I was a kotlin dev and wanted to add a new function, where would the actual implementation be? or if i wanted to modify the signature of an existing function by adding a new argument with a default valueSlackbot
03/04/2021, 5:45 PMCdev
03/04/2021, 7:55 PMinline fun <reified T : Any> jsonToConfig(stringJson: String): T? =
Json.decodeFromString<T?>(stringJson)
Using Kotlinx Serialization decoding from the string works fine in Kotlin. But in Swift:
let projectConfig: ProjectConfig? = config.jsonToConfig<ProjectConfig>(stringJson: jsonString)
I get the following error: "Cannot explicitly specialize a generic function". Any ideas how I could go about getting this to work?