목록링크모음/코틀린 (12)
올해는 머신러닝이다.
fun appendList(listOfLists: List, toAppend: List): List { }Of course both of the following work:fun appendList(listOfLists: List, toAppend: List): List { // Use spread operator return listOf(*listOfLists.toTypedArray(), toAppend); } fun appendList(listOfLists: List, toAppend: List): List { // Turn to mutable list val ret = listOfLists.toArrayList() ret.add(toAppend) return ret } But this is conf..
You have two choices:The first and most performant is to use associateBy function that takes two lambdas for generating the key and value, and inlines the creation of the map:val map = friends.associateBy({it.facebookId}, {it.points})The second, less performant, is to use the standard map function to create a list of Pair which can be used by toMap to generate the final map:val map = friends.map..
https://medium.com/@joongwon/kotlin-kotlin-%ED%82%A4%EC%9B%8C%EB%93%9C-%EB%B0%8F-%EC%97%B0%EC%82%B0%EC%9E%90-%ED%95%B4%EB%B6%80-part-3-59ff3ed736be?source=rss-1ee57944eab8------2
http://www.baeldung.com/kotlin-when
https://wiki.v.anil.la/w/index.php?title=%EC%B0%B8%EA%B3%A0%EC%84%9C:Kotlin/%ED%81%B4%EB%9E%98%EC%8A%A4%EC%99%80_%EA%B0%9D%EC%B2%B4/%EC%A0%91%EA%B7%BC_%EC%A0%9C%EC%96%B4%EC%9E%90&mobileaction=toggle_view_mobile
https://android.jlelse.eu/rxkotlin-login-screen-7413ba6b5e4f
https://github.com/importre/blog/blob/master/content/post/kotlin-let-apply-run-with-use.md
바로가기
코틀린 Junit testhttps://proandroiddev.com/using-kotlin-for-tests-in-android-6d4a0c818776 핵심은 sourceSets { test.java.srcDirs += 'src/test/kotlin' } } afterEvaluate { android.sourceSets.all { sourceSet -> if (!sourceSet.name.startsWith("test")) { sourceSet.kotlin.setSrcDirs([]) } } } 으로 해서 릴리즈땐 제거 해주고 testCompile "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_ver" 을 추가 해주는게 핵심..
https://pluu.gitbooks.io/kotlin/content/