https://kotlinlang.org logo
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
getting-started
  • e

    enighma

    01/24/2017, 10:43 PM
    Personally, I would try to avoid
    null
    though.
    d
    • 2
    • 4
  • p

    poohbar

    01/28/2017, 6:18 PM
    how can I slice a list in Kotlin?
    e
    • 2
    • 1
  • o

    okkero

    02/01/2017, 10:26 AM
    @victortong That's interesting. You really think Kotlin feels like C#? I don't think I'd ever use Kotlin if it felt like C# to me. Coming from C# to Kotlin is one heck of a relief.
    👍 1
    v
    k
    • 3
    • 6
  • e

    elect

    02/01/2017, 2:13 PM
    use ` ``` ` to wrap your code
    🙂 1
    v
    • 2
    • 1
  • h

    hackerham

    02/02/2017, 5:21 PM
    then use it in kotlin instead of "dynamic" type, type aliases will help to have the same code in "testing-generation" phase and "hot" phase
    • 1
    • 1
  • e

    elect

    02/02/2017, 7:48 PM
    wait, so it's possible? @sreich
    s
    e
    • 3
    • 4
  • e

    elect

    02/03/2017, 8:45 AM
    I'd need to have a top level property and initialize it later. Since
    lateinit
    is not available for this case, which is my best alternative?
    m
    • 2
    • 2
  • e

    electrolobzik

    02/04/2017, 11:07 AM
    Hey guys! Why code completion doesn’t suggest and help to create anonymous class object in kotlin? When creating arguments for RxJava methods I used to tap “( new” and than just could hit enter and get the whole instance declaration with overided methods. How can I achive the same in Kotlin? (get ready instance with code completion)
    ➕ 1
  • c

    cedric

    02/07/2017, 4:38 AM
    @victortong C-F12?
    v
    • 2
    • 1
  • o

    okkero

    02/07/2017, 10:46 AM
    fun foo(a: ClassA) {
        val b: ClassA.ClassB = with(a) {
            object : ClassA.ClassB() {
    
            }
        }
        println(b)
    }
    Given the above code, IDEA does not complain, but the compiler throws an internal error when trying to compile it. This may be a bug...
    a
    • 2
    • 5
  • n

    nkiesel

    02/07/2017, 7:56 PM
    Good point. So I just have to list all the array variants that Kotlin supports. Would be a nice candidate for the stdlib... Thanks for your help!
    m
    o
    j
    • 4
    • 14
  • l

    lorenzopaoliani

    02/08/2017, 3:14 PM
    @stoyicker can you please post your "build.gradle"
    s
    • 2
    • 11
  • n

    nkiesel

    02/09/2017, 7:53 AM
    that works (surprisingly), but
    println(""""""hello""")
    does not (and neither does
    println(""""""hello"""""")
    )
    v
    • 2
    • 2
  • b

    brianwernick

    02/09/2017, 9:35 PM
    Yeah, any method call on the object can use the
    ?.
    notation for safety
    v
    • 2
    • 3
  • b

    brianwernick

    02/09/2017, 9:50 PM
    I don’t think the
    .flatMap { it }
    in this case is really doing anything. But I’ve been working with RxJava a lot lately (that has a different flatMap) so I’m probably confusing myself
    v
    • 2
    • 1
  • m

    mdow814

    02/10/2017, 1:18 AM
    Hey guys, I have a background in python and want to learn Kotlin. Is it a good idea to learn java before Kotlin? I'm just unsure where to start with Kotlin.
    v
    o
    • 3
    • 4
  • m

    mdow814

    02/10/2017, 1:53 AM
    Ok thanks guys for the info. I was advised by another to do the koans and I'm doing those now. I was looking at Kotlin in action too
    v
    • 2
    • 2
  • o

    okkero

    02/10/2017, 5:38 PM
    @victortong: i think you need the
    operator
    modifier
    v
    • 2
    • 1
  • u

    uhe

    02/15/2017, 12:59 PM
    I ended up doing something similar
    u
    • 2
    • 2
  • m

    miha-x64

    02/16/2017, 5:09 PM
    ^ It is not initialized, it has overridden getter
    👍 3
    v
    • 2
    • 1
  • d

    dalexander

    02/16/2017, 7:02 PM
    It’s just a shortcoming of the
    ..
    operator. I’m fairly certain that’s intended behavior, even though it got me too the first time I tried to count down.
    v
    • 2
    • 2
  • z

    zokipirlo

    02/17/2017, 9:55 AM
    I need help with enums. Is possible to go to next enum value easier than solution in this example? http://try.kotlinlang.org/#/UserProjects/vfgallbbhplq0mau2aatvj7u4h/m3qu18a7lgpdl7tjr76vpr1a4i
    m
    m
    b
    • 4
    • 5
  • o

    orangy

    02/17/2017, 9:20 PM
    I don’t think there is
    asIterable
    for an iterator…
    v
    • 2
    • 4
  • s

    stoyicker

    02/18/2017, 6:19 PM
    why isn’t the return type
    ImmutableList
    ?
    m
    v
    • 3
    • 4
  • b

    benleggiero

    02/19/2017, 4:49 AM
    Are `constructor`s automatically `inline`d?
    v
    s
    • 3
    • 8
  • r

    robin

    02/20/2017, 8:15 AM
    @Tristan Caron Well, how are you imagining this would work? To implement the interface, you have to know what functions and properties the interface defines at compile time - that's not possible with normal generics.
    t
    • 2
    • 3
  • n

    nekoinemo

    02/20/2017, 9:00 AM
    Thank you, didn't know about that channel. Found the GSK snapshot compatible with rc-91
    e
    • 2
    • 3
  • c

    chillenious

    02/21/2017, 7:08 PM
    Hi all. I’m about to get into Kotlin. Would you recommend using dependency injection (and if so, what’s a great framework for it), or would it be doing it wrong going that route with Kotlin? When coding Java, I prefer to work with Guice fwiw.
    c
    • 2
    • 1
  • u

    uhe

    02/23/2017, 9:55 AM
    Just as an idea
    fun loadCoupons(): Observable =
            loadCouponsCachedObservable ?:
                    createObservable().apply { loadCouponsCachedObservable = this }
    👍 3
    b
    g
    • 3
    • 2
  • i

    izorin

    02/23/2017, 10:11 AM
    I am not sure that I understand what single exclamation mark means. Can you explain, please?
    r
    • 2
    • 1
Powered by Linen
Title
i

izorin

02/23/2017, 10:11 AM
I am not sure that I understand what single exclamation mark means. Can you explain, please?
r

robin

02/23/2017, 11:40 AM
geralt_encore: One exclamation mark means that it is a platform type - i.e. it comes from code not governed by the kotlin compiler, and kotlinc cannot deduce whether the value in question is effectively nullable or not.
View count: 4