https://kotlinlang.org logo
Docs
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
announcements
  • s

    Shawn

    12/27/2018, 6:22 PM
    repositories = modules.associate { it to "<mailto:git@bitbucket.org|git@bitbucket.org>:my/${it}.git" }
    👍 3
    • 1
    • 1
  • x

    xenoterracide

    12/27/2018, 6:25 PM
    next dumb question, how would I concatenate list a to list b, creating list c? (does + work? )
    s
    • 2
    • 2
  • k

    karelpeeters

    12/27/2018, 6:45 PM
    You could make
    plotAPI
    lazy:
    val plotAPI by lazy { PlotAPI() }
    a
    • 2
    • 1
  • h

    Hamza

    12/28/2018, 5:52 AM
    anyone have good ideas for lighterweight text editors instead of idea? I try using vim but more suggestions are welcome. Idea is really heavy on my computer
    s
    g
    +3
    • 6
    • 35
  • g

    gildor

    12/28/2018, 10:12 AM
    oh, target version is 1.3.20 %)
    🎂 1
    🎉 1
    i
    • 2
    • 2
  • k

    karelpeeters

    12/28/2018, 10:13 AM
    Out of interest, what use cases do you have? Just things similar to
    contains
    ?
    d
    • 2
    • 7
  • j

    Jakub Gwóźdź

    12/28/2018, 10:23 AM
    Hi. Are there any mature gradle plugins and/or just command line tools to enforce official coding conventions? Something like eslint for .js, or checkstyle for java?
    h
    t
    g
    • 4
    • 8
  • j

    Jérôme Gully

    12/28/2018, 11:18 AM
    Hi. I'm following a codelabs course from google "Android Room with a View - Kotlin" and I don't understand the part which the database is instancied with a volatile var into an companion object. Why the
    INSTANCE
    var is assigned to a
    tempInstance
    to check if it is null ? and why in the synchronizrd block the
    INSTANCE
    is assigned to
    instance
    and the
    instance
    is returned instead of
    INSTANCE
    ? I missunderstood something i guess.
    Volatile_var__.kt
    a
    a
    • 3
    • 18
  • h

    hhariri

    12/28/2018, 3:46 PM
    <!here> The ‘Most Helpful Slack Community Member’ voting is over, and the winner of 2018 is @gildor! Congratulations to Andrey and many thanks for your effort! JetBrains is happy to give you a special prize – DJI Spark quadcopter. We are grateful to everyone who voted and especially to our finalists @jw, @louiscad, @karelpeeters, @Shawn, @kpgalligan, @thomasnield, @edvin, @irus, and @raulraja. You really drive the community by making it helpful and friendly every day. JetBrains wants to thank every finalist and give them a one year subscription to All Products Pack. We also want to acknowledge @Ruckus who was upvoted after the nominating was closed but is recognized by the Kotlin community as a helpful member, and award him with a subscription too. Thanks to everyone for the fruitful year and happy holidays!
    :kotlin-flag: 24
    🙏 7
    ❤️ 2
    👏 26
    🔥 5
    🎉 89
    😱 6
    🤠 3
    👍 6
    a
    r
    • 3
    • 2
  • n

    nerses

    12/28/2018, 3:50 PM
    Congrats @gildor! Please keep it away from Gatwick 😄
    👌 1
    😂 6
    g
    • 2
    • 1
  • g

    gildor

    12/28/2018, 3:51 PM
    Wow! Thanks everyone! I only worry that with quadcopter I will be less helpful for Kotlin community 😂🛸
    😂 1
    😄 6
    🤣 7
    🚁 12
    😅 1
    b
    r
    • 3
    • 3
  • b

    Bimawa

    12/28/2018, 3:58 PM
    Damn cool!!! Congrat Andrey!!!!
    g
    • 2
    • 1
  • t

    thomasnield

    12/28/2018, 4:12 PM
    @gildor congrats. Keep it away from airports and drone patrol eagles

    https://spectrum.ieee.org/image/MjcxNTUzNg.gif▾

    🦅 1
    g
    • 2
    • 10
  • k

    karelpeeters

    12/28/2018, 4:16 PM
    Congrats @gildor and everyone else nominated!
    👍 6
    g
    • 2
    • 1
  • s

    Shawn

    12/28/2018, 4:18 PM
    Congrats @gildor! You’d better share some slick drone footage with us once you get it airborne lol
    ☝️ 3
    g
    s
    • 3
    • 2
  • j

    joelpedraza

    12/28/2018, 8:51 PM
    Library author would like to promise that the property is final, as opposed to just read-only.
    l
    • 2
    • 1
  • j

    JoshK

    12/29/2018, 4:07 AM
    Which of the nuggets of advice in the pinned thread are people finding works best to convince bosses to try to Kotlin? The business value ones?
    g
    • 2
    • 1
  • k

    K J

    12/29/2018, 7:00 AM
    Hey there; Just a little question: Why is this an unchecked cast?
    val items = mutableListOf<T>()
    
    override fun <U : T> typedItems(): List<U> {
        return items.mapNotNull { it as? U }
    }
    but this is not?
    val oldStuff = mutableListOf<List<*>>()
    val newStuff = oldStuff.mapNotNull { it as? ArrayList<*> }
    d
    • 2
    • 3
  • r

    Ramin

    12/29/2018, 7:48 AM
    I've just coming from php and it's framework usually provide such boilerplates
    s
    • 2
    • 7
  • b

    benleggiero

    12/29/2018, 5:25 PM
    Wh… um… I have no idea how to resolve this…
    d
    • 2
    • 1
  • i

    itnoles

    12/29/2018, 9:04 PM
    you finds more information about out in https://kotlinlang.org/docs/reference/generics.html
    b
    s
    • 3
    • 4
  • a

    Andrew Gazelka

    12/30/2018, 1:10 AM
    is there a best practice for when to use arrays/lists/varargs as parameters?
    r
    e
    • 3
    • 2
  • s

    Shawn

    12/30/2018, 3:30 AM
    decoupling? Do you mean destructuring?
    a
    d
    • 3
    • 12
  • m

    Maruru

    12/30/2018, 7:15 AM
    Hi, is there any AOP framework (except Spring) that support Kotlin coroutine yet?
    w
    • 2
    • 2
  • w

    Wahib

    12/30/2018, 10:48 AM
    Serious question 🙂 https://twitter.com/wahibhaq/status/1079327710642610176
    t
    s
    • 3
    • 3
  • f

    fdlk

    12/30/2018, 1:47 PM
    Can I do a destructuring assignment only into newly declared variables?
    :yes: 1
    h
    • 2
    • 2
  • s

    Sebastian Sellmair [JB]

    12/30/2018, 2:01 PM
    Does anyone have experience in working with ktor inside a 'kotlin-multiplatform' project? I cannot run the main method because the MainKt class cannot be found (even though the canonical name is correct)
    s
    s
    • 3
    • 2
  • d

    Daniel

    12/30/2018, 2:06 PM
    Might it be planned to make the
    { }
    optional when writing a anonymous class?
    object  : xyz(...) {   }
    Seems like a minor inconsistency since they are optional with 'normal' classes
    g
    d
    • 3
    • 7
  • s

    Saiedmomen

    12/30/2018, 6:40 PM
    enclosing the verify block in
    runBlocking
    doesn't work
    d
    • 2
    • 5
  • r

    robstoll

    12/30/2018, 11:40 PM
    is it somehow possible to deal with the following problem.
    interface I1{ fun foo(f: (Int) -> Int) }
    interface I2{ fun foo(f: (String) -> String) }
    class A: I1, I2{
      override fun foo(f: (Int) -> Int){}
      override fun foo(f: (String)-> String){} //same JVM signature
    }
    p
    h
    c
    • 4
    • 5
Powered by Linen
Title
r

robstoll

12/30/2018, 11:40 PM
is it somehow possible to deal with the following problem.
interface I1{ fun foo(f: (Int) -> Int) }
interface I2{ fun foo(f: (String) -> String) }
class A: I1, I2{
  override fun foo(f: (Int) -> Int){}
  override fun foo(f: (String)-> String){} //same JVM signature
}
p

Pavlo Liapota

12/30/2018, 11:52 PM
Maybe
@JvmName
will help? https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.jvm/-jvm-name/index.html
Seems it only works for global functions
h

hudsonb

12/31/2018, 12:11 AM
This has bit me a number of times, AFAIK there's no way around it. Be awesome if
@JvmName
could be used as a work around (I havent tried it). We need a
@Mangle
annotation or something that will mangle it for us on the Java side when we don't care about being callable from the Java side of things.
👍 1
c

Czar

12/31/2018, 7:48 AM
This works for me:
interface I1 {
	fun foo(l: (Int) -> Int): Int
}

interface I2 {
	fun foo(l: (String) -> String): String
}

class A : I1, I2 {
	override fun foo(l: (Int) -> Int): Int = l(1)
	override fun foo(l: (String) -> String): String = l("a")
}

fun test() {
	println(A().foo { p: Int -> p * 2 })
	println(A().foo { p: String -> p + p })
}
I guess problem is only there if the return type is the same.
r

robstoll

12/31/2018, 9:22 AM
Ah sorry, return type should have been the same
View count: 2