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

    jackmiras

    07/21/2017, 3:33 PM
    Hey guys, how are you doing? I'm trying to load some files from a package but when my app is "compressed" into a .jar file I'm getting a class not found exception. Apparently this is happening because in the .jar file the structure of the project change.
    v
    • 2
    • 2
  • m

    mat

    07/22/2017, 2:00 PM
    I actually have knowledge of coding in other language and mostly OOP too... I major in Web Development (PHP, codeigniter -> CakePHP), Understands and Uses OOP... with knowledge of python, VB, Java but i never did a project with em, i only passed through their learning phase as Web Dev is my thing. But i want make Kotlin my major static language which will give me the advantage of coding for Web in Kotlin as well.. But then i just thought I should know the recommended learning path..
    d
    • 2
    • 1
  • e

    egoscio

    07/22/2017, 8:03 PM
    I've seen the advancements in Kotlin Native, and it's impressive, however what about Apple's native API's?
    v
    • 2
    • 2
  • m

    mpcjanssen

    07/23/2017, 8:58 AM
    kotlin doesn't have them. But it's commonly used in for example haskell. They won't work for situations with unlimited different types though.
    • 1
    • 3
  • k

    kevinmost

    07/23/2017, 1:56 PM
    and libGDX seems to always be thinking about Kotlin support nowadays https://github.com/libgdx/libgdx/wiki/Using-libGDX-with-Kotlin
    m
    j
    • 3
    • 2
  • d

    dumptruckman

    07/23/2017, 5:55 PM
    this is possible in Java but I can't figure out how to do it in Kotlin
    v
    • 2
    • 2
  • s

    supaham

    07/23/2017, 7:57 PM
    if I have a
    fun args(args: Iterable<String>)
    and i pass it an Array<String> it says array is not a subtype of iterable. What's the solution to this problem?
    d
    • 2
    • 10
  • t

    tschuchort

    07/23/2017, 9:27 PM
    I don't know how they are implemented though
    v
    • 2
    • 1
  • p

    pakoito

    07/24/2017, 12:24 AM
    is there any flag for the compiler not to generate functions that have been inlined? as I understand they’re created only for the purpose of keeping Java’s interop, and maybe debugging
    v
    e
    • 3
    • 4
  • e

    evkaky

    07/24/2017, 7:55 AM
    guys, I need some Char value, that indicates the EOF (end of file), some special value, that 100% won’t appear in the regular text input. What can I use?
    val eof = '\0' // doesn't work
    d
    • 2
    • 1
  • e

    evkaky

    07/24/2017, 8:05 AM
    There is no such thing as a EOF character
    really sadly
    v
    • 2
    • 4
  • r

    rrader

    07/24/2017, 8:06 AM
    why in Java I can write @Api(tags = "Auth") but in Kotlin I must write @Api(tags = arrayOf("Auth"))
    v
    e
    p
    • 4
    • 4
  • f

    fred.deschenes

    07/24/2017, 2:16 PM
    Hey guys, I have a question/possible bug with type inference, is this the right channel to ask?
    v
    • 2
    • 3
  • n

    nekoinemo

    07/25/2017, 4:39 AM
    Well, Kotlin just hit 1.0 couple months ago and until Google's IO conf you had to explicitly look for alternative JVM languages to even learn it exists... I think even being in top 50 is good enough progress
    ✅ 1
    k
    • 2
    • 1
  • c

    codematix

    07/25/2017, 7:01 AM
    any help?
    k
    • 2
    • 2
  • f

    fabianterhorst

    07/25/2017, 10:13 AM
    Is kotlin generating setters for vars that are private as well, or how can i prevent the compiler from generating setters for var´s
    r
    k
    • 3
    • 26
  • f

    feroz_baig

    07/25/2017, 11:14 AM
    Anyone here who worked with coroutines, please share your opinions. If familiar with RxJava2, please contrast both of them as well
    r
    • 2
    • 4
  • k

    kevinmost

    07/25/2017, 3:12 PM
    but then maybe my ideal world would have
    foo: String
    and
    foo: mut String
    , and no
    val
    and
    var
    😛
    r
    • 2
    • 4
  • k

    kevinmost

    07/25/2017, 3:16 PM
    stuff(): Job = launch(UI) { ... }
    k
    u
    • 3
    • 9
  • l

    leonardkoch

    07/25/2017, 3:37 PM
    Anyone know if a move to named destructuring is planned? It is so much more flexible and less error prone.
    i
    • 2
    • 1
  • d

    damian

    07/25/2017, 5:01 PM
    Ideally there should be an intrinsic for
    until
    😞
    👍 2
    e
    • 2
    • 3
  • i

    ilya.gorbunov

    07/25/2017, 6:29 PM
    until
    will get an intrinsic in 1.1.4 https://youtrack.jetbrains.com/issue/KT-9900
    👍 4
    e
    v
    d
    • 4
    • 12
  • p

    passsy

    07/25/2017, 11:12 PM
    Just wrote my first DSL in kotlin. I’m a little sad that the resulting object cannot be immutable.
    a
    v
    • 3
    • 5
  • b

    blakelee

    07/26/2017, 3:44 AM
    Is it possible to have multiple get()'s? Some that take parameters
    s
    • 2
    • 1
  • k

    karelpeeters

    07/26/2017, 6:25 AM
    @supaham That doesn't work right now?
    s
    • 2
    • 1
  • r

    roamingthings

    07/26/2017, 6:59 AM
    If I have a code fragment like
    val myNullableString : String?
    val resultingString = if (myNullableString.isNullOrBlank()) myNullDefaultString else String.format(myNullableString!!, someOtherString)
    I have to use
    myNullableString!!
    in
    String.format()
    since the compiler would not be able to figure out that
    isNullOrBlank()
    includes a null-check. Is this correct or is there any way to tell the compiler that a function will infer that the instance is not null?
    p
    • 2
    • 2
  • f

    feroz_baig

    07/26/2017, 8:10 AM
    fun main(args: Array<String>) = runBlocking {
                val job = launch(CommonPool) {
                    var nextPrintTime = System.currentTimeMillis()
                    var i = 0
                    while (i < 10) { // computation loop
                        val currentTime = System.currentTimeMillis()
                        if (currentTime >= nextPrintTime) {
                            println("I'm sleeping ${i++} ...")
                            nextPrintTime += 500L
                        }
                    }
                }
                delay(1300L) // delay a bit
                println("main: I'm tired of waiting!")
                job.cancel() // cancels the job
                delay(1300L) // delay a bit to see if it was cancelled....
                println("main: Now I can quit.")
                }
    Why is the job not cancelled after calling it explicitly?
    p
    • 2
    • 2
  • r

    rrader

    07/26/2017, 9:45 AM
    I have a class
    data class Login(@get:NotBlank @get:Size(min=3) @JsonProperty(value = "login", required = true) val login: String, 
                      @get:NotBlank @JsonProperty(value = "password", required = true) val password: String)
    annotations are used for validation, validation is executed after constructor but before validation, I need to trim
    login
    and
    password
    , in order to reject values as " r " for
    login
    , because real value is "r" and size is 1, which is less than 3 how to do this in Kotlin?
    r
    • 2
    • 6
  • g

    gabrielfv

    07/26/2017, 10:33 PM
    It is possible to make it like
    val something = someExpr()
        get() = someOtherExpr()
    class Foo {
        var bar = 2
        	get() {
                tar *= 4
                return tar
            }
        
        var tar = 3
    }
    😱 3
    d
    c
    • 3
    • 10
  • p

    poohbar

    07/27/2017, 8:23 AM
    wait, nevermind.. it cant be null because Kotlin
    k
    • 2
    • 1
Powered by Linen
Title
p

poohbar

07/27/2017, 8:23 AM
wait, nevermind.. it cant be null because Kotlin
k

kagomez

07/27/2017, 2:51 PM
it can if you need it to be null
View count: 2