I read the documentation for a long time, but did not fully understand how it works.
The inner voice whispers that these two lines should do the same thing:
private fun makePost(post: Map<String, String>): RequestBody { val body = FormBody.Builder() 1: post.forEach { (k, v) -> body.add(k, v) } 2: post.forEach { body::add } return body.build() } But do not. The first works, and the second does not (body remains empty, but there are no errors)
please explain where my inner voice screwed up and is it possible (how?) to use the function reference here?
Kotlin, what do you use? - Eugene Krivenjabuild.gradlethat this version is inbuild.gradle? Plugin plugin, and suddenly not pull up? :) - Eugene Krivenjaext.kotlin_version = '1.1.2-3',classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"?compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"- rjhdby