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
announcements
  • o

    ohwelp

    08/16/2018, 9:23 AM
    Is it possible to use Kotlin as an addition language in huge Java 6 project that uses gradle on top of ant to build it?
    n
    d
    • 3
    • 7
  • k

    karelpeeters

    08/16/2018, 12:19 PM
    And what's the total length? Are you on windows? What's the actual exception thrown?
    t
    • 2
    • 2
  • a

    Ayden

    08/16/2018, 1:36 PM
    Hi. Anyone used to implement data binding to TextInputLayout?
    🚓 1
    :stackoverflow: 4
    😕 1
    😐 1
    :google: 3
    a
    c
    • 3
    • 2
  • c

    christophsturm

    08/16/2018, 1:56 PM
    does the kotlinc repl mode support tab completion somehow?
    🇳🇴 1
    n
    g
    • 3
    • 11
  • m

    Mohit Gurumukhani

    08/16/2018, 5:03 PM
    I am using experimental multiplatform features from Kotlin 1.2.60 and the build is successful only by adding @ExperimentalMultiplatform annotation to every class or function that uses it. Is there a way around this?
    d
    • 2
    • 3
  • n

    Nikhil

    08/16/2018, 6:51 PM
    Can someone just tell me how to take the input using standard i/o in kotlin/native ?
    a
    • 2
    • 1
  • s

    Seri

    08/16/2018, 8:49 PM
    Off the top of my head, this compiles and may be what you’re looking for—
    sealed class OutsideGroup {
        class Option1: OutsideGroup()
        class Option2: OutsideGroup()
    
        sealed class InsideGroup: OutsideGroup() {
            class Option3: InsideGroup()
            class Option4: InsideGroup()
        }
    }
    
    fun returnOuter(): OutsideGroup = OutsideGroup.Option1()
    
    fun returnInner(): OutsideGroup.InsideGroup = OutsideGroup.InsideGroup.Option3()
    a
    t
    • 3
    • 12
  • s

    supaham

    08/16/2018, 11:53 PM
    Is there a slack for intellij generally?
    🇳🇴 1
    🆗 1
    s
    • 2
    • 3
  • j

    jkbbwr

    08/17/2018, 3:00 AM
    Why isn't this 255 as expected
    r
    k
    i
    • 4
    • 8
  • j

    jkbbwr

    08/17/2018, 3:02 AM
    Also
    @ExperimentalUnsignedTypes
    fun main(args: Array<String>) {
        var a: UByte = 0u
        println(--a) // -1
    }
    but
    @ExperimentalUnsignedTypes
    fun main(args: Array<String>) {
        var a: UByte = 0u
        --a
        println(a)  // 255
    }
    😬 4
    :youtrack: 4
    p
    i
    • 3
    • 7
  • k

    karelpeeters

    08/17/2018, 10:58 PM
    Untitled.kt
    👏 1
    d
    • 2
    • 2
  • r

    rahulpr27

    08/18/2018, 4:15 AM
    Need feedback
    Untitled.kt
    k
    h
    • 3
    • 8
  • k

    karelpeeters

    08/18/2018, 5:01 PM
    You can normal normal Kotlin files with
    psvm
    in them just fine in AS.
    j
    • 2
    • 3
  • n

    Nikky

    08/19/2018, 12:33 PM
    i really like suspend and coroutines, but i am really sad that callable references to suspend functions do not work.. that was how i added memoization to those functions.. any idea how to replicate something like that
    val cachedCall = ::expensiveCall.memoize()
    with suspend functions ?
    e
    • 2
    • 2
  • g

    gmariotti

    08/19/2018, 5:31 PM
    Hi everyone, does anyone know if there is any plan for a Kotlin compile option
    jvmTarget = "11"
    ? And what would be the implications from a performance/optimization point of view?
    e
    • 2
    • 2
  • d

    david-wg2

    08/20/2018, 9:06 AM
    is klint the best option?
    c
    • 2
    • 1
  • m

    Matt

    08/20/2018, 3:07 PM
    Sadly,
    Error
    includes more than just fatal JVM throwables (e.g.
    AssertionError
    ), which is why Scala has
    NonFatal
    s
    k
    • 3
    • 9
  • e

    epool

    08/20/2018, 6:53 PM
    this code doesn’t complain in compilation time but in runtime if I don’t specify the type of
    classLoaders: Array<out ClassLoader>?
    when
    *classLoaders
    is passed as parameter
    val classLoaders = reflections.configuration.classLoaders // Array<out ClassLoader>?
    ReflectionUtils.forNames<Any>(reflections.allTypes, *classLoaders)
    a
    p
    +2
    • 5
    • 23
  • e

    edwardwongtl

    08/21/2018, 8:13 AM
    val defaults: MutableLiveData<Boolean> = MutableLiveData().apply { value = false }
    ➕ 1
    d
    f
    • 3
    • 2
  • b

    Bernhard

    08/21/2018, 11:10 AM
    interface EntityRepository<T> {
    
        fun fullTextSearch(text: String?, selectedIds: Array<String>?, exclude: Boolean?, size: Int): List<T>
    
        fun textSearch(text: String?, size: Int): List<T> {
            return fullTextSearch(text, null, null, size)
        }
    }
    c
    • 2
    • 2
  • a

    ahegazy

    08/21/2018, 1:03 PM
    If you have some validation method like
    isValidUsername
    or
    isValidEmail
    , do you feel it’s okay to write this as an extension method to String?
    l
    a
    +2
    • 5
    • 8
  • g

    GarouDan

    08/21/2018, 5:05 PM
    Do we have in Kotlin an easy way to find all inner paths of one specific folder? For example kotlinFunction(‘./folder’) outputs:
    ./folder/subfolder1
    ./folder/subfolder2/subfolder21
    j
    d
    • 3
    • 4
  • j

    jo

    08/22/2018, 1:22 AM
    A bit of a JVM-specific question, but is there a performance difference in using a Canvas in JavaFX versus an ImageView with a BufferedImage back? Which is more performant? (Side note: there are some results on Google which seem to say it's faster to write to a buffered image and others that say canvas. I'm not sure which.)
    r
    k
    • 3
    • 4
  • c

    Can Orhan

    08/22/2018, 11:44 AM
    Hi! Why is this OK
    rebookingList.filter {
            val data = it.data
            when (data) {
                is AccountFeedItem<*> -> {
                    data.data is FeedItemTreatment
                }
                else -> false
            }
        }
    But this isn't?
    rebookingList.filter {
            when (it.data) {
                is AccountFeedItem<*> -> {
                    it.data.data is FeedItemTreatment
                }
                else -> false
            }
        }
    d
    i
    • 3
    • 3
  • v

    Viral Thakker

    08/22/2018, 1:38 PM
    is there any way to check difference between two objects and returned changed property ?
    g
    • 2
    • 1
  • r

    rakeeb

    08/22/2018, 3:43 PM
    when would you choose to use
    let
    instead of
    run
    . I find
    run
    more convenient, cause of the lamda receiver (no
    it
    is my reason for choosing it over
    let
    ), but I want to know if I’m using misusing these functions.
    i
    • 2
    • 1
  • d

    diesieben07

    08/22/2018, 9:31 PM
    How would I best go about producing multiple lists from a single one? Right now I am doing two
    map
    operations after another, but that requires me to do some computations twice. Do I really have to write a for loop and add to two lists? Example:
    val list = listOf(1, 2, 3)
    val a = list.map { expensiveOperation(it).value1 }
    val b = list.map { expensiveOperation(it).value2 }
    g
    • 2
    • 4
  • t

    Tony Hoyle

    08/22/2018, 9:33 PM
    Make a list of the pair (value1, value2) then split it?
    d
    i
    • 3
    • 4
  • k

    Krs

    08/23/2018, 4:59 AM
    Hi guys I have a small question. What happened to Spek? Wasn't it a JB official library?
    m
    • 2
    • 2
  • b

    Bernhard

    08/23/2018, 8:37 AM
    I've created an interface for the two that I have and I can't define the interface as sealed
    d
    g
    • 3
    • 11
Powered by Linen
Title
b

Bernhard

08/23/2018, 8:37 AM
I've created an interface for the two that I have and I can't define the interface as sealed
d

diesieben07

08/23/2018, 8:38 AM
Interfaces cannot be sealed due to JVM constrains. You need an abstract base class that you seal.
b

Bernhard

08/23/2018, 8:40 AM
I can't have abstract classes for data classes, correct?
g

gildor

08/23/2018, 8:40 AM
data class cannot be abstract, sure
d

diesieben07

08/23/2018, 8:40 AM
But data classes cannot be inherited from, period.
But you can do this:
sealed class Sealed {
    data class OptionA(val foo: String) : Sealed()
    data class OptionB(val foo: Int) : Sealed()
}
b

Bernhard

08/23/2018, 8:43 AM
then use Sealed as type name for OptionA/OptionB?
d

diesieben07

08/23/2018, 8:44 AM
Yes
b

Bernhard

08/23/2018, 8:44 AM
ah right, that would require me to do match clauses based on the classes listed
when*
d

diesieben07

08/23/2018, 8:44 AM
Yes, that's how sealed classes work
b

Bernhard

08/23/2018, 8:44 AM
thank you
View count: 1