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

    Hamza

    09/22/2018, 1:05 AM
    is there any way i can get a bunch of photos of the kotlin branding? im creating a presentation for my school and i want high quality pictures for my presentations 🙂
    s
    • 2
    • 3
  • v

    vaskir

    09/22/2018, 6:21 AM
    What I'm missing here?
    e
    • 2
    • 3
  • v

    vaskir

    09/22/2018, 8:58 AM
    Is
    /** .. */
    the only doc comments style available? It's too verbose for single-line comments, see for example https://github.com/google/iosched/blob/master/model/src/main/java/com/google/samples/apps/iosched/model/Session.kt
    e
    • 2
    • 20
  • s

    Slackbot

    09/22/2018, 6:06 PM
    This message was deleted.
    🚓 1
    👮‍♂️ 1
    s
    j
    m
    • 4
    • 4
  • m

    muralimohan962

    09/22/2018, 6:20 PM
    I am able to access private property when the object is sent as parameter to its functions.
    n
    • 2
    • 1
  • m

    mantono

    09/22/2018, 7:59 PM
    Yes, it is supposed to work, it just does not work in 1.3.0-rc-57 it seems.
    k
    • 2
    • 2
  • r

    redrield

    09/23/2018, 10:21 PM
    Could someone elaborate on where/when I should be using Sequence<*> vs Collection<*>? IntelliJ has started giving me lints recommending that a call chain should use Sequence, but I'm still confused as to when I should use that. I know that Sequences are lazy and Collections are eager, but I'm not sure when to use either
    v
    k
    • 3
    • 4
  • r

    redrield

    09/23/2018, 10:21 PM
    Here's some code that IntelliJ recommended I used Sequence with (hence the asSequence and toList)
    task.command.requiredSubsystems.asSequence().filter { msg.shouldStartDefault(it) }
                        .mapNotNull(Subsystem::defaultCommand).toList()
                        .forEach {
                            handle(Message.Start(it))
                        }
    g
    • 2
    • 1
  • n

    nwh

    09/24/2018, 2:17 AM
    Are there any academic papers on the concept of suspension/continuation style programming versus classic threading?
    g
    • 2
    • 3
  • r

    Ramin

    09/24/2018, 8:40 AM
    if it's possible try to make slide screen in a bigger size we don't need to see the guy who make speech all the time. in kotlinconf 2017 I have problem with slide size 🙂
    h
    h
    • 3
    • 4
  • r

    ribesg

    09/24/2018, 12:11 PM
    Is
    equals
    implemented for an inline class, or do I have to do it? It seems obvious to me that it should be implemented, as easy as it is, but I would like to be sure
    r
    • 2
    • 1
  • e

    elect

    09/24/2018, 12:14 PM
    so, I got a
    Vec3
    class where I retrieve components as
    override var x: Float
            get() = array[ofs]
            set(value) = array.set(ofs, value)
    Why from java
    getX()
    returns
    Float
    instead
    float
    ?
    a
    p
    d
    • 4
    • 17
  • p

    paulex

    09/24/2018, 1:06 PM
    Please, i'd like to build a small application(using kotlin) that can be installed into a device that is movable. Would also like that i can maybe connect to the device via a console to configure certain things. The device should also be able to broadcast hotspot etc... Where can i start from or what can i read more about this.
    h
    k
    • 3
    • 7
  • r

    razvandragut

    09/24/2018, 5:19 PM
    cool, will post it in IntelliJ channel
    d
    • 2
    • 1
  • a

    Andreas Sinz

    09/24/2018, 8:32 PM
    class Person private constructor(val name: String, val age: Int) : Individual { 
        //stuff 
    }
    
    fun Person(name: String, age: Int): Person {
        require(age >= 18)
    
        return Person(name, age)
    }
    h
    • 2
    • 23
  • s

    Shawn

    09/24/2018, 10:00 PM
    myMap.getOrPut(key) { arrayListOf() }.add(i)
    👏 3
    m
    • 2
    • 1
  • n

    Nikky

    09/24/2018, 10:24 PM
    can i add custom getters to var/val in the main constructor of a data class ?
    s
    • 2
    • 1
  • a

    avolkmann

    09/25/2018, 1:48 AM
    Anyone else having problems after upgrading to 1.2.7x ?
    h
    m
    • 3
    • 9
  • k

    karelpeeters

    09/25/2018, 8:15 AM
    What do you want to happen? An error? Note that
    typealias
    and
    import
    are very different,
    typealias
    is only about the type,
    import
    is the actual class but the classname can also happen to represent the type.
    f
    a
    • 3
    • 4
  • o

    Onur

    09/25/2018, 11:00 AM
    Why do I get different results (
    originalContent2
    contains 1 extra space after “ipsum” while
    originalContent
    does not)?
    s
    • 2
    • 2
  • a

    apatrida

    09/25/2018, 11:06 AM
    What is
    kotless
    ? https://plugins.jetbrains.com/plugin/10886-kotless-plugin @Andrey Tarasenko @brk @guredd @tanvd
    👀 1
    t
    • 2
    • 4
  • k

    karelpeeters

    09/25/2018, 12:21 PM
    @apatrida It's probably just a bit of wordplay, Kotlin + serverless.
    👍 1
    a
    t
    • 3
    • 4
  • k

    karelpeeters

    09/25/2018, 12:52 PM
    Child<String>
    is not in general a subtype of
    Parent<Any>
    , go trough this page: https://kotlinlang.org/docs/reference/generics.html
    r
    h
    • 3
    • 2
  • r

    Ruckus

    09/25/2018, 7:26 PM
    map[key] = map.getOrDefault(key, 0) + 1
    a
    c
    • 3
    • 3
  • j

    jw

    09/25/2018, 7:29 PM
    map.compute(key) { k, v -> (v ?: 0) + 1 }
    a
    • 2
    • 2
  • c

    Casey Brooks

    09/25/2018, 7:30 PM
    map[key] = (map[key]?:0) + 1
    r
    • 2
    • 1
  • j

    jdemeulenaere

    09/25/2018, 8:40 PM
    Anyone working on a Kotlin multiplatform support for gRPC? i.e. generating multiplatform client (& server, although less useful) code that can be used in common projects ? It'd be a super nice way to easily make RPC & streaming in a Kotlin MultiPlatform project, in addition to the recent HttpClient from ktor 🙂
    👍 1
    g
    l
    • 3
    • 2
  • r

    ribesg

    09/26/2018, 8:10 AM
    The new
    when
    thing in
    1.3 RC
    is reformatted incorrectly by IDEA:
    val value = when (val type = peek()) {
                        JsonToken.BOOLEAN -> nextBoolean()
                        JsonToken.NULL -> nextNull().let { null }
                        else -> throw Error("Unexpected type $type")
                    }
    After auto-formatting:
    val value = when (
                        val type = peek()) {
                        JsonToken.BOOLEAN -> nextBoolean()
                        JsonToken.NULL -> nextNull().let { null }
                        else -> throw Error("Unexpected type $type")
                    }
    There is no matching option under the
    when
    close in
    Code Style
    . Is this a bug / missing feature? It happens with both the old default IDEA style and the new one.
    😱 2
    g
    c
    k
    • 4
    • 13
  • s

    Slackbot

    09/26/2018, 10:49 AM
    This message was deleted.
    o
    h
    • 3
    • 2
  • r

    Ruckus

    09/26/2018, 6:33 PM
    Quick question: why do we need to specify which types are reified in an inline function? As it's inlined, aren't all types basically automatically reified?
    s
    • 2
    • 1
Powered by Linen
Title
r

Ruckus

09/26/2018, 6:33 PM
Quick question: why do we need to specify which types are reified in an inline function? As it's inlined, aren't all types basically automatically reified?
s

Sam

09/26/2018, 11:41 PM
Here the Person object is kept track in a generic Java Object type
data class Person( val age : Int )

fun main(args: Array<String>) {
    "sample".printParameters( "string", Person(22 ) )
}

private inline fun <reified T, R> String.printParameters( value1 : T, value2 : R ) {
    println( "$this $value1 $value2" )

    when( this ) {
        is T -> println( "Object is of type ${T::class.java}" )
        else -> println( "Unknown type")
    }
}
View count: 2