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

    Mateus Andrade

    10/17/2018, 2:27 PM
    Hello people, can you give to me examples of big companies that are using Kotlin on the server-side? I need more good examples/use cases to justify why use Kotlin in my company 😉
    t
    h
    +4
    • 7
    • 15
  • c

    cjmartinkoski

    10/17/2018, 4:21 PM
    it's possible to build simple single binary in kotlin native like in go? i'm planning simple CLI to automate simple tasks
    k
    c
    a
    • 4
    • 6
  • n

    Nikky

    10/17/2018, 5:18 PM
    is there some way to get the result of a function call into a const val ? some sort of pure function annotation that allows it to be executed at compiletime ?
    🇳🇴 2
    r
    s
    +2
    • 5
    • 13
  • j

    jw

    10/17/2018, 7:11 PM
    this is a cyclic reference problem and it's usually solved by breaking apart responsibilities into three (or more) things which don't need to reference themselves instead of just two
    🎯 1
    n
    n
    +2
    • 5
    • 12
  • p

    pavel

    10/17/2018, 10:12 PM
    who is the author of that presentation? Andrey Breslav?
    k
    • 2
    • 2
  • h

    Hamza

    10/18/2018, 12:03 AM
    is there any info on the netbeans plugin support? some students in my school are interested in kotlin but can’t switch to IDEA as they have never used and prefer netbeans
    m
    d
    +4
    • 7
    • 17
  • v

    Vladyslav Sitalo

    10/18/2018, 9:08 AM
    Can someone point me at good explanation of why
    lateinit
    does not work with the basic types (e.g. `Int`/`Long`/etc)? Googling tells me that it’s because of the way kotlin represents those types, but It’s still fuzzy for me. So I’d appreciate a link or an explanation 🙂
    e
    k
    • 3
    • 8
  • l

    lukaswelte

    10/18/2018, 9:15 AM
    runCatching
    https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/run-catching.html is in the API docs as there since version 1.0 for JVM. I use (Java 8 Maven project)
    <dependency>
    	<groupId>org.jetbrains.kotlin</groupId>
    	<artifactId>kotlin-stdlib-jdk8</artifactId>
    	<version>1.2.71</version>
    </dependency>
    But it does not contain the function (IntelliJ won’t find it). Is that a documentation bug, or do I need to import the stdlib in another way?
    v
    e
    • 3
    • 3
  • j

    Jukka Siivonen

    10/18/2018, 11:57 AM
    How should I make this (Spring) formatter implementation support LocalDate? (nullable)
    fun localDateFormatter(): Formatter<LocalDate> {
            return object : Formatter<LocalDate> {
                override fun parse(text: String, locale: Locale): LocalDate {
                    return LocalDate.parse(text, DateTimeFormatter.ISO_DATE)
                }
                override fun print(obj: LocalDate, locale: Locale): String {
                    return DateTimeFormatter.ISO_DATE.format(obj)
                }
            }
        }
    n
    • 2
    • 32
  • p

    pp.amorim

    10/18/2018, 1:15 PM
    I don't need and want any optional there
    d
    s
    • 3
    • 15
  • s

    SiebelsTim

    10/18/2018, 1:32 PM
    -Xno-param-assertions
    does pretty much exactly what you want. I don't know if the performance impact is really relevant though
    p
    g
    • 3
    • 4
  • a

    AzMoo

    10/19/2018, 1:27 AM
    Hey, I’ve got two data classes like so:
    data class FleetUnitJson(
        val id: Int,
        val stock_no: String,
        val children: List<FleetUnitJson>
    )
    
    data class FleetUnit(
        val id: Int,
        val stock_no: String
    )
    How can I create a FleetUnit from a FleetUnitJson? I can pass all the properties to the constructor of course but I thought there might be an easier way.
    a
    g
    • 3
    • 3
  • h

    Hullaballoonatic

    10/19/2018, 2:49 AM
    why was the word "map" used as the name of such a function instead of "collect"? wouldn't the latter be easier to understand, especially when maps are already types of collections?
    g
    • 2
    • 1
  • h

    Hullaballoonatic

    10/19/2018, 2:51 AM
    i remember learning about maps being called "dictionaries", but i've only ever heard them referred to as maps since
    m
    v
    • 3
    • 2
  • h

    Hullaballoonatic

    10/19/2018, 2:56 AM
    i so desperately want short notation for enum constants in kotlin. the preceding class names are just so verbose and i love writing kotlin like prose. if the context is enough to let the compiler know what enum class is being referred to, then it should be enough for readers, too. and even if not, the short notation could be optional. that probably takes quite a bit of effort from kotlin team to implement, though, and it's not as important as some of the really key features they added in 1.3
    d
    e
    • 3
    • 2
  • u

    ursus

    10/19/2018, 3:24 AM
    always use separate network and db models
    👍 2
    e
    • 2
    • 19
  • h

    Hullaballoonatic

    10/19/2018, 4:22 AM
    are there kotlin functions that constrain number parameters to a range?
    k
    • 2
    • 7
  • u

    ursus

    10/19/2018, 4:23 AM
    Is there any tool that can warn me about thrown exceptions of the method called (especially java methods)?
    h
    • 2
    • 2
  • h

    Hullaballoonatic

    10/19/2018, 4:23 AM
    meaning in their definition, not as a min(max()) set method
    e
    k
    • 3
    • 9
  • h

    Hullaballoonatic

    10/19/2018, 5:25 AM
    So I think I answered my own first question. The functionality can be implemented and made into a library, but the syntax cannot be. It'd have to be a PR to the compiler that kotlin team accepted, or something?
    e
    • 2
    • 9
  • l

    lynas

    10/19/2018, 5:26 AM
    How to achieve Thread.sleep(2000) or something related like this in kotlin native??
    e
    • 2
    • 3
  • a

    ahulyk

    10/19/2018, 7:59 AM
    Hi) I'm trying to test New Type Inference! But I can not configure it( I use gradle kotlin DSL with plugin: kotlin("gradle-plugin", "1.3.0-rc-190") and kotlin version kotlin("stdlib-jdk7", "1.3.0-rc-190") I can not enable newInference in gradle DSL:
    kotlin {
        experimental {
            newInference = "enable" //this does not compile
        }
    }
    because ExperimentalExtension is missing newInference variable
    org.jetbrains.kotlin.gradle.dsl.ExperimentalExtension:
    open class ExperimentalExtension {
        var coroutines: Coroutines? = null
    }
    h
    j
    • 3
    • 4
  • f

    Filip Husnjak

    10/19/2018, 9:13 AM
    Hey guys Is there a nice way to parse XML to a data class? My solution converts the xml to json and then to a data class is there a better way?
    d
    • 2
    • 2
  • h

    Hexa

    10/19/2018, 9:16 AM
    is there a better way of declaring that my function will throw an exception without using a annotation? Example I use the`Throw` annotation
    @Throws(NoSuchAlgorithmException::class)
        private fun generateKeyPair(): KeyPair {
            
        }
    d
    u
    s
    • 4
    • 38
  • t

    Tsvetozar Bonev

    10/19/2018, 11:33 AM
    Hello, I have a map of format <String, Int> and want to sort it ascending by the Int value, how would I do this in Kotlin?
    e
    h
    +3
    • 6
    • 15
  • s

    Strum355

    10/19/2018, 12:23 PM
    Hey, I've a quick-ish question regarding variance. Im having issues wrapping my head around how function parameters are contravariant. Specifically, this excerpt from wikipedia
    both functions of type Cat -> Cat and Animal -> Animal can be used wherever a Cat -> Animal was expected.
    . Ik its not strictly kotlin related, but kotlin does have the in-out keywords.
    r
    • 2
    • 6
  • s

    sbyrne

    10/19/2018, 2:12 PM
    Untitled.kt
    a
    e
    r
    • 4
    • 12
  • g

    gabrielfv

    10/19/2018, 3:22 PM
    How would you deal with a method that depends on a non-null value but is called by java code that may pass a null value? 1️⃣ (May produce NPE when called from Java)
    fun method(obj: Class) { //... }
    2️⃣ (Will do nothing when
    obj
    is null)
    fun method(obj: Class?) {
        if (obj == null) return
        // ...
    }
    3️⃣ (Behaves like 2, assignment notation also applies
    method(...) = obj?.let{
    , which may be seen as better alternative?)
    fun method(obj: Class?) {
        obj?.let {
            // Wraps whole method around this block, up to 10 lines of code
        }
    }
    2️⃣ 1
    m
    b
    • 3
    • 3
  • g

    gabrielfv

    10/19/2018, 3:22 PM
    Personally, I'd go with 2, which is how I dealt with this in Java
    s
    b
    +2
    • 5
    • 21
  • a

    alisidhu

    10/20/2018, 4:44 AM
    is there any java language for android channel on slack not kotlin?
    h
    s
    o
    • 4
    • 6
Powered by Linen
Title
a

alisidhu

10/20/2018, 4:44 AM
is there any java language for android channel on slack not kotlin?
h

Hamza

10/20/2018, 4:45 AM
this is a kotlin slack. we don’t have java related channels here
s

Shawn

10/20/2018, 4:45 AM
you might want android united
or 😒tackoverflow:
a

alisidhu

10/20/2018, 4:47 AM
yes i need a android java channel like this
o

orangy

10/20/2018, 4:59 AM
Check title of #android channel, there is information about non-Kotlin Android Slack.
a

alisidhu

10/20/2018, 5:14 AM
ok
View count: 2