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

    bostonmacosx

    08/10/2019, 1:43 AM
    Stripe experrience anyone?
    ❓ 2
    r
    k
    • 3
    • 4
  • b

    bostonmacosx

    08/10/2019, 4:08 AM
    Untitled.txt
    s
    • 2
    • 6
  • i

    Ifvwm

    08/10/2019, 1:55 PM
    what’s eitherT from arrow? what’s the monad transformer?
    k
    • 2
    • 1
  • j

    Joaquim Ley

    08/10/2019, 4:30 PM
    Hello Anyone has exp with moshi when dealing with different types on the same property? My specific use case, I have a variable that sometimes returns an object and others a boolean 🤷‍♂️ I know this must be done with adapters but I haven’t been able to get it to work, since all the examples I read is from a int to bool or something like that, not primitive to object Thanks in advance 💪 ```
    d
    k
    • 3
    • 16
  • n

    nyxcode

    08/10/2019, 6:44 PM
    Hey, what's the current state of database support in kotlin? I plan on building a rest api using ktor. Suprisingly, I couldn't find a proper async driver for MariaDB. Is there a reliable JDBC wrapper using kotlin coroutines?
    m
    m
    +4
    • 7
    • 28
  • v

    v79

    08/11/2019, 6:59 AM
    Are inline functions like
    forEach
    ,
    forEachIndex
    ,
    File.walk()
    just syntactic sugar that I can use instead of
    (for x in y)
    or should I be much for careful when using them? I've discovered that
    forEach
    cannot be mocked with a library like mockk and that's playing havoc with my testing.
    h
    s
    +3
    • 6
    • 12
  • i

    Iaroslav Postovalov

    08/11/2019, 9:35 AM
    Hi! When I extend a Java method that has
    String[]
    in signature Kotlin recommends to have it as
    Array<out String>
    . It is literally useless because
    String
    is
    final
    in Java.
    j
    k
    d
    • 4
    • 5
  • w

    william

    08/11/2019, 11:26 PM
    are there any built in sealed classes that accepts any primitive?
    k
    g
    • 3
    • 6
  • f

    fangzhzh

    08/12/2019, 3:42 AM
    Hi, where Can I find the kotlin language specification?
    g
    • 2
    • 5
  • d

    dG

    08/12/2019, 9:00 AM
    Does
    public static <T extends Enum<T>> T valueOf(Class<T> enumType, String name)
    of
    Java.lang.Enum
    not have an equivalent in Kotlin? If not, why not?
    d
    • 2
    • 1
  • k

    Kavin

    08/12/2019, 11:57 AM
    But we can skip the index if we need?
    s
    d
    a
    • 4
    • 11
  • m

    Marko Mitic

    08/12/2019, 2:46 PM
    Is this type inference bug?
    list
    is
    MutableList<Bucket>
    r
    • 2
    • 3
  • s

    Slackbot

    08/12/2019, 3:40 PM
    This message was deleted.
    k
    • 2
    • 1
  • s

    Saiedmomen

    08/13/2019, 5:54 AM
    somethings wrong with my SAM conversions
    k
    • 2
    • 1
  • r

    rcd27

    08/13/2019, 5:56 AM
    @Saiedmomen try to explicitly enter the type like
    val x: Observable<Optional<String>> = ...
    k
    s
    • 3
    • 2
  • d

    david-wg2

    08/13/2019, 8:30 AM
    could anyone explain why smart-cast doesn’t work for range checks?
    if (pin?.length != 36) throw UnauthorizedResponse()
    // pin is smart cast here
    if (pin?.length !in (8..36)) throw UnauthorizedResponse()
    // pin is not smart cast here
    g
    c
    k
    • 4
    • 16
  • a

    aaverin

    08/13/2019, 9:35 AM
    Is there already a ticket to discuss possibilities to improve destructuring in Kotlin? I find this to be very very confusing, especially comparing to Javascript:
    interface Parent {
        val a: String
        val b: String
    }
    
    data class Person1(
        override val a: String = "Person1 a",
        override val b: String = "Person1 b"
    ): Parent
    
    data class Person2(
            override val b: String = "Person2 b",
            override val a: String = "Person2 a"
    ): Parent
    
    fun main() {
        val person1 = Person1()
        val person2 = Person2()
        
        person1.let {
            val (a, b) = person1
            println("Destructuing person1, a is ${a}, b is ${b}")
    	}
        person2.let {
            val (a, b) = person2
            println("Destructuing person2, a is ${a}, b is ${b}")
    	}
    }
    Results in
    Destructuing person1, a is Person1 a, b is Person1 b
    Destructuing person2, a is Person2 b, b is Person2 a
    https://pl.kotl.in/sUDuggWbx
    d
    s
    +3
    • 6
    • 18
  • j

    Joffrey

    08/13/2019, 2:34 PM
    Hi guys, any idea when the next 1.3.50-eap of the gradle plugin is coming?
    g
    • 2
    • 2
  • j

    Jakub

    08/13/2019, 2:47 PM
    *Unfortunately we have troubles with running all tests when they are mixed
    junit
    &
    spek
    . We would like to migrate from
    Spek 2
    framework to pure
    junit4
    in our project. In our case that’s a ton of tests. Have you seen any converter that does that?
    c
    m
    +2
    • 5
    • 7
  • b

    bbaldino

    08/13/2019, 7:59 PM
    is there a way to invoke
    associateBy
    which would support a mapping that was one to many? i.e. translate a
    List<Foo>
    where
    Foo
    is, say,
    data class Foo(val valueOne: Int, val valueTwo: String)
    to a
    Map<Int, List<String>>
    ?
    • 1
    • 1
  • k

    Kapil Godhwani

    08/13/2019, 10:32 PM
    A general query, what would be a good approach to start a Kotlin frontend project. Should I go about using the Kotlin HTML DSL, or should I do a React interop. The backend is Kotlin first with Ktor and exposed. I was preferring Kotlin route but didn't find good references to start something there. Any pointers?
    d
    r
    • 3
    • 2
  • j

    jkbbwr

    08/14/2019, 1:04 AM
    Anyone know of a good way to print deeply nested data classes with indentation
    d
    • 2
    • 3
  • h

    hkokocin

    08/14/2019, 7:33 AM
    I cannot seem to find a way to access date/time/timestamps in Kotlin Native. Am I just blind or is there no out of the box way? Any suggestions?
    ✔️ 1
    k
    m
    • 3
    • 7
  • a

    Andreas Du Rietz

    08/14/2019, 7:40 AM
    What HTTP lib would you suggest for screenscraping (saving session cookies etc)? I’m looking for something like “requests” for python and scala. Ease of use would be the biggest factor
    c
    m
    +2
    • 5
    • 5
  • c

    coder82

    08/14/2019, 8:26 AM
    Is ther a way to get rid of all the @UseExperimental like declarations, wasn't there a way to just specify this to the compiler via gradle?
    s
    • 2
    • 7
  • l

    LastExceed

    08/14/2019, 9:56 AM
    is
    import MyClass as SomeType
    the same as
    import MyClass
    typealias SomeType = MyClass
    ?
    g
    d
    d
    • 4
    • 8
  • j

    Joshlemer

    08/14/2019, 2:14 PM
    Hey folks, I was wondering, what mechanism in Kotlin allows that
    java.util.LinkedHashMap<Int,Int>
    somehow implements
    kotlin.collections.Map<Int,Int>
    ? Is there scala-style implicit conversion / wrapping going on?
    val lhm: kotlin.collections.Map<Int, Int> = java.util.LinkedHashMap()
    l
    d
    • 3
    • 3
  • r

    ryn1x

    08/14/2019, 6:10 PM
    How can I set a close event for a view in TornadoFX? I have been searching the documentation and ide autocomplete and cannot figure it out.
    k
    • 2
    • 2
  • s

    Seri

    08/14/2019, 6:39 PM
    Is it possible to reference a specific inheritor from an abstract parent, rather than any possible inheritor? For example, if I have a
    abstract class State
    with some helper functions, can I have them return the child type, without it getting generalized to just “anything that inherits from `State`“?
    k
    s
    • 3
    • 15
  • n

    Nezteb

    08/14/2019, 8:57 PM
    Does there exist a lib for Kotlin similar to https://www.hangfire.io/ in C#? Something for processing background jobs? I assume coroutines can be used this way, but they don’t have a builtin method for batching/retry logic that I know of.
    j
    p
    n
    • 4
    • 5
Powered by Linen
Title
n

Nezteb

08/14/2019, 8:57 PM
Does there exist a lib for Kotlin similar to https://www.hangfire.io/ in C#? Something for processing background jobs? I assume coroutines can be used this way, but they don’t have a builtin method for batching/retry logic that I know of.
j

josh

08/14/2019, 9:00 PM
Have you taken a gander at Spring batch and other Java related batch APIs?
n

Nezteb

08/14/2019, 9:02 PM
I’m familiar with Batch but this project does not use Spring. I’d rather avoid an entire DI framework just for batching.
“other Java related batch APIs” is the kind of thing I’m asking about; I know of none other than Spring Batch.
👍 1
p

Pablichjenkov

08/14/2019, 9:15 PM
I have no experience with Hangfire in particular. Have not seen similar library either. For sure you could do a Task Manager program using kotlin Coroutines. I see they announce
fire and forget
kind of paradigm, normally Coroutines are more like
fire and control
philosophy. Structured Concurrency as first class citizen.
n

nfrankel

08/14/2019, 9:15 PM
unrelated to kotlin but quartz is probably your best bet http://www.quartz-scheduler.org/
View count: 4