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

    Hexa

    11/10/2018, 5:41 PM
    why there's no difference between the output of these two? Im trying to understand when to use
    k()
    and when not to use it.
    val fruits = listOf("apple", "aabb", "ab", "apricot", "banana", "blueberry", "cherry", "coconut")
    val evenFruits = fruits.k()
                .fold(listOf<String>()) { acc, e -> if (e.length % 2 == 0) acc + e else acc }
    
    val evenFruits2 = fruits
               .fold(listOf<String>()) { acc, e -> if (e.length % 2 == 0) acc + e else acc }
    
    println(evenFruits) 
    println(evenFruits2)
    s
    • 2
    • 1
  • h

    Hullaballoonatic

    11/10/2018, 7:40 PM
    i'm saying it'd be nice if i didn't have to write
    toDouble()
    all over my mathematics in kotlin 😑
    k
    c
    • 3
    • 39
  • j

    Jeremy

    11/11/2018, 1:28 PM
    Excuse me for my non-technical question, but are there any French people here? I would like to create a French community (meetup) in the Bordeaux region.
    :kotlin-flag: 1
    🇫🇷 1
    n
    • 2
    • 3
  • f

    frellan

    11/11/2018, 3:48 PM
    object CachedDB {
    
        val Foods = object {
            fun loadAll(): List<Food> = ...
        }
    }
    I want to be able to call that function like this
    CachedDB.Foods.loadAll()
    but I can’t Do I have to move it all into a separate file?
    r
    s
    • 3
    • 4
  • a

    anli

    11/11/2018, 8:53 PM
    Is there annotation (1.2.x) to force compiler to rise error on not-exhaustive
    when
    ?
    n
    k
    o
    • 4
    • 10
  • a

    alexcouch

    11/11/2018, 10:26 PM
    The only way I can hotswap right now is by going to Run -> Reload Changed Classes in debug mode
    d
    j
    c
    • 4
    • 10
  • c

    cndkhuong

    11/12/2018, 6:50 AM
    how_do_you_think__guys__.md
    s
    h
    b
    • 4
    • 6
  • o

    Ovsyannikov Alexey

    11/12/2018, 7:35 AM
    Hello Anybody knows how to exclude null values when we try to serialize some object into, for example, json?
    g
    h
    c
    • 4
    • 26
  • d

    deviant

    11/12/2018, 10:33 AM
    guys, is there a way to install Kotlin 1.3 plugin into Idea 2017.1? it offers me only 1.2.41 😞
    k
    j
    +2
    • 5
    • 8
  • e

    edwinRNDR

    11/12/2018, 2:14 PM
    What tools can I use to generate media rich documentation from annotated runnable code? I have prepared an example of what I want to do in a gist: https://gist.github.com/edwinRNDR/917fe9398e8e0571e518f750df25b136 . It basically requires a tool that transforms Kotlin source code and I am not sure if such a thing exists
    • 1
    • 1
  • d

    Dias

    11/12/2018, 4:18 PM
    Hi, I am trying to make custom annotation for Guice in kotlin codebase, it currenly doesn't recognize kotlin annotations it seems. There was a suggestion to use kapt to make it work, but I am not sure what exactly should I do with it
    💯 1
    c
    • 2
    • 14
  • m

    Marc Knaup

    11/12/2018, 4:52 PM
    A dedicated #releases channel would be nice for public announcements of new Kotlin versions or the libraries/tooling around it 🙂
    h
    • 2
    • 1
  • j

    Javier

    11/12/2018, 8:18 PM
    how can I solve this warning?
    a
    • 2
    • 1
  • i

    igor.wojda

    11/12/2018, 9:03 PM
    Hey I am playing with teamcity Kotlin DSL configuration. 1. First problem is that I don’t have code completion, so I don’t know what syntax I can use (my configuration is stored in project
    .teamcity/settings.kts
    ) - AS 3.2.1 2. Secound is that I can’t find link to proper documentation, where all the DSL syntax is explained in detail
    i
    • 2
    • 3
  • n

    nwh

    11/13/2018, 2:09 AM
    For standalone (non-Android) applications, what is everyone's preferred DI library?
    g
    c
    +2
    • 5
    • 53
  • d

    David Hamilton

    11/13/2018, 8:30 AM
    As a regular user of the Dash offline API reference browser, I'm seeing a lot of uninstallable javadoc libraries (
    httk4k
    and
    vavr-kotlin
    for instance). Both have published javadoc jars that are empty apart from the MANIFEST, and both use Gradle to build. Also, the Kotlin stdlibs are missing from the available docsets. It feels that this is a systemic problem for Kotlin, and one that is a real negative for someone, like me, who likes to read the statement of how the code is intended to be used, rather than just relying on the current implementation (in source) Are there any plans to fix this?
    a
    g
    +3
    • 6
    • 45
  • m

    mersan

    11/13/2018, 11:51 AM
    Sorry, may I ask why the
    kotlin.Result
    class set to inline class? what's the point of this limitation that we cannot use it as return type?
    a
    k
    • 3
    • 3
  • p

    peterholak

    11/13/2018, 2:18 PM
    Or do I have to do that optimization manually?
    i
    c
    • 3
    • 3
  • g

    gotoOla

    11/13/2018, 3:01 PM
    Hi! I have a project with kotlin.version 1.2.61. Since a few weeks ago I get a problem every now and then where it can’t resolve the “kotlinx.coroutines.experimental”-package in intellij and it suggests me to change to the kotlinx.coroutines-package for things such as runBlocking etc. Has anyone seen something similar? Have I upped a plugin which I shouldn’t have?
    • 1
    • 2
  • c

    christophsturm

    11/13/2018, 3:13 PM
    can i tell the kotlin compiler that it should not allow to use jdk methods that are not in jdk 1.8? (that have a
    @since 9
    annotation for example). or do i have to use 1.8 to build?
    h
    n
    • 3
    • 6
  • p

    pp.amorim

    11/13/2018, 3:20 PM
    Hi guys, how to suppress
    Condition is always 'true'
    ? I tried to use
    @Suppress("SENSELESS_COMPARISON")
    and
    @SuppressWarnings('ConstantConditions')
    but both are not working .
    y
    • 2
    • 1
  • p

    pp.amorim

    11/13/2018, 3:21 PM
    m
    • 2
    • 2
  • c

    Corentin Leffy

    11/13/2018, 3:22 PM
    oh ok...
    p
    • 2
    • 3
  • p

    pdpi

    11/13/2018, 4:36 PM
    hey folks, is there a way to combine property and interface delegation? Something akin to:
    interface Foo {}
    class Bar(): Foo {}
    
    class DelegatedFoo: Foo by foo {
      val foo by lazy { Bar() }
    }
    🇳🇴 1
    s
    • 2
    • 2
  • p

    pniederw

    11/13/2018, 9:44 PM
    How comes
    kotlin-scripting-common:1.3.10
    depends on
    kotlinx-coroutines-core:0.26.1-eap13
    (an outdated EAP version)?
    n
    i
    • 3
    • 6
  • b

    bartvh

    11/14/2018, 10:44 AM
    Is it not possible to call an inline lambda with another inline lambda as argument? Conceptually I think it should be, but I guess the compiler does not actually support it? I get an
    illegal usage of inline argument block
    error
    -.txt
    a
    k
    • 3
    • 5
  • b

    Bernhard

    11/14/2018, 11:50 AM
    only seems to validate the protocol https://docs.oracle.com/javase/8/docs/api/java/net/URL.html#URL-java.lang.String-
    e
    • 2
    • 1
  • c

    carlos cdmp

    11/14/2018, 11:51 AM
    When I do this, am I creating an instance of DisposableProvider for each Interactor instance?
    b
    • 2
    • 3
  • s

    Slackbot

    11/14/2018, 12:05 PM
    This message was deleted.
    a
    p
    • 3
    • 3
  • y

    Yutsa

    11/14/2018, 3:39 PM
    Is there a clean way to get a nullable type from a Spring Data repository ? I tried the following code that is not working :
    class BeerService(val repository : BeerRepository){
        fun getBeerById(id : Long) : Beer? {
            return repository.findById(id)
        }
    }
    🍺 3
    s
    • 2
    • 1
Powered by Linen
Title
y

Yutsa

11/14/2018, 3:39 PM
Is there a clean way to get a nullable type from a Spring Data repository ? I tried the following code that is not working :
class BeerService(val repository : BeerRepository){
    fun getBeerById(id : Long) : Beer? {
        return repository.findById(id)
    }
}
🍺 3
s

sdeleuze

11/14/2018, 10:49 PM
The recommanded approach it to add a custom findByIdOrNull() that returns a nullable value in the repository interface. Also please vote for https://jira.spring.io/browse/DATACMNS-1346.
View count: 3