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
  • d

    droidrcc

    05/26/2018, 5:27 PM
    I was expecting that these two coroutines were running sequentially since they are running on a single thread context, but why they still run concurrently?
    g
    • 2
    • 1
  • d

    droidrcc

    05/26/2018, 5:42 PM
    But is not what I was expecting, they should run sequentially… since they are using the same thread
    k
    b
    o
    • 4
    • 3
  • l

    louiscad

    05/26/2018, 10:12 PM
    @karelpeeters Coroutines remove callback hells, and allow for easy thread or thread pool switching. They allow to write asynchronous code in a sequential style. Best Kotlin feature IMHO
    👍 3
    k
    o
    • 3
    • 10
  • r

    robstoll

    05/27/2018, 2:22 PM
    import kotlin.also as alsoFromKotlin
    infix fun <T> T.also(block: (T) -> Unit): T = alsoFromKotlin(block)
    ✔️ 2
    h
    • 2
    • 1
  • r

    robstoll

    05/27/2018, 2:23 PM
    then
    kotlin.also(this, block)
    would work
  • k

    karelpeeters

    05/27/2018, 8:46 PM
    Turns out someone wrote a blog post about this exact issue: https://galex.co.il/2017/11/04/Dont_Use_lambads_as_listeners_in_Kotlin.html
    c
    • 2
    • 2
  • d

    droidrcc

    05/27/2018, 9:04 PM
    .getEvents().observe((LifecycleOwner)this, (Observer)null.INSTANCE);
    g
    • 2
    • 1
  • d

    droidrcc

    05/27/2018, 9:06 PM
    I will open an issue on the aac
  • d

    droidrcc

    05/27/2018, 9:22 PM
    I will open the issue in any case, maybe could be a way to check the Observer reference in a different way in the library
    g
    • 2
    • 1
  • c

    Czar

    05/27/2018, 9:23 PM
    For those who didn't read till the end, lambdas can still be used if they implement interface: https://galex.co.il/2017/11/07/Dont_Use_lambdas_as_listeners_in_Kotlin_Update.html
    c
    • 2
    • 1
  • w

    warriorprincess

    05/28/2018, 12:36 PM
    any idea why the
    else if
    work though?
    d
    c
    • 3
    • 8
  • a

    avolkmann

    05/28/2018, 2:31 PM
    The issue may be the enums
    k
    • 2
    • 2
  • w

    wathek

    05/29/2018, 12:46 AM
    Hi everybody, I have a question when using generics in class is there a way to get the name of the passed generic ? I mean in case I have this :
    class Test<T: C1> {
      fun getTypeName(): String {
         // Return what is T 
      }
    }
    
    fun main(args: Array<String>) {
      val t = Test<String>
      println(t.getTypeName()) // Returns String
    }
    g
    a
    c
    • 4
    • 4
  • h

    hallvard

    05/29/2018, 1:41 PM
    I love how
    when
    cleans up my code. Used with
    in
    , checking if an element is in a collection is very simple. Now have I overlooked the possibility of doing it the other way around? I.e. is it possible to do something like this (pseudo-code):
    when (collection-of-strings) {
      has "string 1" -> handleString1()
      has "string 2" -> handleString2()
      has "string 3" -> handleString3()
      else -> throw Exception()
    }
    😍 1
    🇳🇴 1
    f
    o
    • 3
    • 8
  • h

    hanpari

    05/29/2018, 4:12 PM
    Is there any way to limit function/method signature to specific types as fun function(x:String|Int) ?
    k
    i
    g
    • 4
    • 21
  • s

    Slackbot

    05/29/2018, 4:22 PM
    This message was deleted.
    k
    • 2
    • 1
  • k

    karelpeeters

    05/29/2018, 4:31 PM
    Why did https://youtrack.jetbrains.com/issue/KT-13108 get closed?
    d
    • 2
    • 2
  • d

    diesieben07

    05/29/2018, 5:30 PM
    I think it is coming: https://github.com/Kotlin/kotlinx.collections.immutable/blob/master/proposal.md
    p
    k
    +2
    • 5
    • 30
  • l

    Lex Luthra

    05/30/2018, 1:39 AM
    Not sure if this is worthy of a response: https://allegro.tech/2018/05/From-Java-to-Kotlin-and-Back-Again.html
    😂 1
    a
    u
    +3
    • 6
    • 6
  • m

    markusa

    05/30/2018, 9:58 AM
    Does IntelliJ not support multiplatform projects correctly at the moment? Everything builds fine in Gradle, but once I import the Gradle project in IntelliJ the JVM module doesn't find any Java dependencies. Gradle runs fine
    a
    • 2
    • 2
  • w

    waqas

    05/30/2018, 10:56 AM
    like in Timber too formatting of the message happens at the very end.
    private void prepareLog(int priority, Throwable t, String message, Object... args) {
          // Consume tag even when message is not loggable so that next message is correctly tagged.
          String tag = getTag();
    
          if (!isLoggable(tag, priority)) {
            return;
          }
          if (message != null && message.length() == 0) {
            message = null;
          }
          if (message == null) {
            if (t == null) {
              return; // Swallow message if it's null and there's no throwable.
            }
            message = getStackTraceString(t);
          } else {
            if (args != null && args.length > 0) {
              message = formatMessage(message, args);
            }
            if (t != null) {
              message += "\n" + getStackTraceString(t);
            }
          }
    
          log(priority, tag, message, t);
        }
    a
    • 2
    • 8
  • g

    GarouDan

    05/30/2018, 1:32 PM
    Where can I find the documentation of this? com.intellij.database.model.DasTable
  • r

    robstoll

    05/30/2018, 3:15 PM
    is there a website where I can run kotlin snippets and import maven dependencies?
    r
    t
    • 3
    • 4
  • a

    Andrei

    05/30/2018, 5:30 PM
    Is there a way to turn all delegation methods private?
    a
    r
    • 3
    • 3
  • a

    adams2

    05/30/2018, 11:13 PM
    how do I pass extension methods by reference
  • b

    bissell

    05/31/2018, 6:38 AM
    Wasn't sure which channel to ask this (#stdlib is a little dead), but I am curious about this KDoc on `LazyThreadSafetyMode.NONE`:
    /**
         * No locks are used to synchronize an access to the [Lazy] instance value; if the instance is accessed from multiple threads, its behavior is undefined.
         *
         * This mode should not be used unless the [Lazy] instance is guaranteed never to be initialized from more than one thread.
         */
    Let's say my
    lazy
    field is calculated from
    val
    inputs on a data class by a deterministic, pure function. I don't mind potentially duplicating the work to calculate it in multiple threads, and would rather elide any synchronization costs. Is there any harm to using
    NONE
    in this case? Maybe some weirdness around Kotlin Native I haven't considered?
    s
    i
    • 3
    • 5
  • l

    Lebohang

    05/31/2018, 7:33 PM
    Good afternoon, can anyone refer me to an article whereby I can learn how to use realm + rxjava + kotlin. I am still new in kotlin any help will be appreciated.
    g
    • 2
    • 2
  • s

    Shawn

    06/01/2018, 4:27 AM
    members.putIfAbsent(key, value)
    b
    • 2
    • 3
  • r

    rik

    06/01/2018, 8:49 AM
    Hi everyone, i'm struggling with a dependency issues. Apparently the kotlin-compiler has some google guava code copied to it? So not a dependency but the actual class files. This is causing a confliflct with the selenium library which uses guava
    g
    k
    d
    • 4
    • 29
  • n

    Ngenge Senior

    06/01/2018, 8:54 AM
    Hello here. I have a Kotlin presentation and was wondering if there is any template for Kt presentations provided by the community
    s
    • 2
    • 2
Powered by Linen
Title
n

Ngenge Senior

06/01/2018, 8:54 AM
Hello here. I have a Kotlin presentation and was wondering if there is any template for Kt presentations provided by the community
s

seetha

06/02/2018, 6:18 PM
there's a kotlin workshop by jetbrains which includes a lot of presentations, it's open source and you can reuse those if you want
n

Ngenge Senior

06/04/2018, 2:53 AM
Thank you
View count: 2