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

    serebit

    11/22/2018, 11:25 PM
    Yeah can we get uhh... mod?
    s
    • 2
    • 2
  • j

    Jakub Aniola

    11/23/2018, 11:33 AM
    Does copy() in data class works the same like clone() in Java Object? Do copied object shares the same HashCode? And - how interface Cloneable is working in Kotlin if Any do not have protected clone() method?
    i
    r
    +3
    • 6
    • 8
  • k

    kenkousen

    11/23/2018, 8:55 PM
    Is there some way I can prove (i.e., write a test case to show) that the list returned by
    listOf(...)
    is immutable (er, unmodifiable)? I tried to use reflection to list the functions on the resulting object, but all the
    add
    ,
    remove
    , etc, methods are still there.
    k
    d
    • 3
    • 5
  • d

    Davio

    11/24/2018, 7:15 AM
    But I'm stuck on the Processor how to add something to the existing method
    i
    p
    • 3
    • 4
  • j

    jdiaz

    11/24/2018, 6:38 PM
    I remember a kotlin java8 with removeIf methods from collections, was that moved somewhere else?
    s
    d
    • 3
    • 7
  • n

    Nir Golan

    11/24/2018, 7:28 PM
    Is there any plan for kotlin support in flutter?
    🔍 2
    🇳🇴 1
    l
    • 2
    • 1
  • a

    agrosner

    11/25/2018, 2:38 AM
    Dart 2 is much better than Java 7/8
    s
    d
    • 3
    • 4
  • h

    Hexa

    11/25/2018, 12:42 PM
    is there a more idiomatic way of writing this
    if(!item.name.isNullOrEmpty()){
                itemMap["name"] = AttributeValue().withS(item.name)
            }
    t
    h
    • 3
    • 14
  • d

    Dalinar

    11/25/2018, 2:49 PM
    is there a list of somewhere of code breaking changes between 1.2 and 1.3 ?
    g
    l
    i
    • 4
    • 5
  • i

    igor.wojda

    11/26/2018, 11:39 AM
    Is there any settting in the IDE (or kotlin-plugin) that would allow me to keep annotations code formatting in the same line inside enum? Now
    enum class LastFmImageSize {
        @field:Json(name = "medium")
        MEDIUM,
        @field:Json(name = "small")
        SMALL
    }
    Want
    enum class LastFmImageSize {
        @field:Json(name = "medium") MEDIUM,
        @field:Json(name = "small") SMALL
    }
    h
    a
    • 3
    • 4
  • z

    zachtib

    11/26/2018, 2:41 PM
    ok, I was asking because there's some properties on the class I'd rather not be public, but maybe I'll have to live with it
    d
    s
    a
    • 4
    • 17
  • r

    reik.schatz

    11/26/2018, 3:25 PM
    given starting point
    val start = 0
    and
    listOf(3, 3, 3, 2)
    representing sizes of IntRange’s, whats the simplest way to turn this into a list of IntRanges? expected outcome
    listOf(IntRange(0, 2), IntRange(3, 5), IntRange(6, 8), IntRange(9, 10))
    d
    j
    +2
    • 5
    • 9
  • t

    tjsnell

    11/26/2018, 5:49 PM
    Information:11/26/18, 12:32 PM - Compilation completed with 1 error and 0 warnings in 1 h 8 m 27 s 315 ms Error:kotlin: [Internal Error] org.jetbrains.kotlin.util.KotlinFrontEndException: Exception while analyzing expression at (47,9) in /Users/tjs/code/kotlin/model-generator/src/test/kotlin/com/juicelabs/fhir/model/TestReportTest.kt
    a
    • 2
    • 17
  • s

    Slackbot

    11/26/2018, 8:35 PM
    This message was deleted.
    d
    a
    • 3
    • 2
  • d

    Daniel

    11/27/2018, 4:59 PM
    Is there a standard library function which would get me all possible combinations of elements in a list?
    listOf(1, 2, 3) -> (1, 2); (1,3); (2,1); (2,3); (3,1); (3,2)
    r
    d
    +4
    • 7
    • 17
  • i

    IAmRasputin

    11/27/2018, 6:50 PM
    Sorry, forgot different workspaces have different sets of Enter/Shift+Enter preferences. Hello, I'm translating some Java code to Kotlin, and one function takes an
    InputStream
    and loops over it, reading fixed-size chunks of bytes from it. However, it uses the Java idiom where assignment is used as an expression:
    byte[] buffer = new byte[CHUNK_SIZE];
    while ((bytesRead = stream.read(buffer, 0, CHUNK_SIZE)) != -1) {
        // do things
    }
    Kotlin, of course, does not like this, as assignments are not expressions. Is there an idiomatic way to iterate over sized chunks from a stream, like
    lines
    but less text-oriented? I could call
    read
    inside and outside the loop, but I'd like to avoid that if possible.
    f
    • 2
    • 5
  • a

    aaverin

    11/28/2018, 9:05 AM
    That was confusing…
    listOf(1,2,3,4,5).forEach {
            if (it > 3) //actually evaluates 5 times
            	return@forEach
        }
    Any way to stop
    forEach
    without using the label?
    s
    d
    +4
    • 7
    • 15
  • i

    igor.wojda

    11/28/2018, 9:27 AM
    Is there a way to select checkboxes (that are shown after extracting property) using keyboard?
    ➕ 4
    d
    • 2
    • 2
  • b

    Bernhard

    11/28/2018, 10:13 AM
    I also want to write HTTP 400 errors into a file (buffered writer) so I guess I need a mutex
    c
    d
    • 3
    • 3
  • d

    dMusicb

    11/28/2018, 9:20 PM
    Does anyone know why I lose the smart cast to non-null in for loop?
    data class Testing(val test: Int = 5)
    var test: Testing? = null
    if (test == null) test = Testing(3)
    test.test // works
    test = test.copy() // works
    for (i in (1..10)) {
      test = test.copy() // complains about test being Testing?
    }
    d
    o
    a
    • 4
    • 22
  • b

    bdawg.io

    11/29/2018, 2:30 AM
    I'm not sure the best place to post this: Any Kotliners attending re:Invent?!
    n
    • 2
    • 1
  • t

    tyjka

    11/29/2018, 2:47 AM
    fun Any.castTo(cast: Something) = this as cast
    What should be in place of Something for this function to work?
    b
    • 2
    • 1
  • s

    Shawn

    11/29/2018, 2:56 AM
    I mean, strictly speaking it’d probably be something like
    inline fun <reified T> Any.castTo() = this as T
    but a) that probably won’t work, b) why do you need this as a function?
    t
    • 2
    • 9
  • i

    igor.wojda

    11/29/2018, 9:50 AM
    val a = 12
    val binaryString = a.toString(radix = 2)
        
    //how to convert binaryString back to Int? Is there any build in function in stdlib?
    d
    d
    • 3
    • 5
  • p

    phldavies

    11/29/2018, 12:22 PM
    When creating data classes extending a sealed class, Is there any way to avoid duplicating the base sealed class properties in every data class? I have a sealed class defining several common properties and several data classes extending it and it's looking rather cumbersome...
    s
    • 2
    • 9
  • b

    bod

    11/29/2018, 12:44 PM
    Hello, World! Is there any documentation somewhere about how
    equals
    work for sealed classes?
    d
    • 2
    • 7
  • h

    hudsonb

    11/29/2018, 1:44 PM
    Given a
    reified R
    I would like to return a default comparator to use based on `R`s type. Is there any way to do something like this?
    inline fun <reified R> defaultComparator(): Comparator<R>? = when {
        R::class.isSubclassOf(Comparable::class) -> naturalOrder<R>()  // Error: Type arg not within bounds
        // ... others
        else -> null
    }
    d
    k
    • 3
    • 7
  • p

    poohbar

    11/29/2018, 2:26 PM
    yo, why is the documentation messed up? this bug has been popping up again and again.. no errors in console, extensions disabled..
    h
    d
    +5
    • 8
    • 31
  • l

    louiscad

    11/29/2018, 4:08 PM
    kotl.in/issue leads to a "Project was not found" error… what happened?
    :youtrack: 1
    r
    s
    • 3
    • 4
  • c

    carolos

    11/29/2018, 4:25 PM
    Does anyone have experience with kotlinx serialization library using maven? IDE reports the .serializer() method is not found when you open the maven example.
    c
    • 2
    • 2
Powered by Linen
Title
c

carolos

11/29/2018, 4:25 PM
Does anyone have experience with kotlinx serialization library using maven? IDE reports the .serializer() method is not found when you open the maven example.
the same project using gradle doesn't have that issue... is there something I am missing
c

cbruegg

12/01/2018, 4:12 PM
I'm having this issue too.
View count: 2