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
getting-started
  • v

    Vladyslav Sitalo

    08/20/2018, 12:16 PM
    Is there a way to get a reference a specific constructor? I.e. if I have
    class Foo(val Bar: String, val Fizz: String = "Buzz")
    then when I do ::Foo, I’d get a reference to a 2 argument constructor (as it’s considered
    primary
    , as I understand), is there a way for me to get a reference to the constructor with 1 argument (besides e.g. getting all constructors and filtering them on that criteria)?
    d
    • 2
    • 3
  • a

    Ayden

    08/21/2018, 3:27 PM
    val a = 5 
    val b = 5.4
    val c = 5.4321
    c
    s
    +2
    • 5
    • 22
  • t

    Thanos Psaridis

    08/22/2018, 8:48 AM
    Any Ideas how can I test an extension function with Mockito? It doesn't seem to work nicely
    Testing_extension_functions.java
    r
    • 2
    • 2
  • m

    maxmello

    08/22/2018, 10:36 AM
    Do I need the Kotlin reflect library to create custom delegates? (As the operator override requires the KProperty class)?
    d
    • 2
    • 2
  • a

    Ayden

    08/22/2018, 12:22 PM
    I always found that I have a difficulty to understand the documentation from Kotlin website.
    inline fun <T, R> with(receiver: T, block: T.() -> R): R (source)
    I don't really understand what is this trying to explain although I have read through the explanation. I know
    T
    might stands for
    Type
    but what does
    R
    stands for? Run? The
    receiver
    is the argument we pass into it? What is
    block
    ?
    R
    i would assume it is the result then. Am I right?
    d
    l
    u
    • 4
    • 6
  • s

    stachu540

    08/23/2018, 7:04 AM
    Looking for programatically solutions evaulate
    String
    into Kotlin-code without using
    kotlinc
    or something existing simmilar. I want use to my project. Better would be a dependency or something.
    s
    h
    n
    • 4
    • 8
  • d

    david-wg2

    08/28/2018, 12:38 PM
    if i'm making a published library that's going to be used from both kotlin and java, what should the scope of
    kotlin-stdlib-jdk8
    be ?
    k
    • 2
    • 1
  • g

    gabrielfv

    08/28/2018, 7:46 PM
    In the following excerpt
    private val dashItemInterface: DashItemInterface = object : DashItemInterface {
        override fun onClick(item: DashItem) {
            item.foo()
        }
    }
    The IDE suggests to convert it to a lambda, however when I set it like that:
    private val dashItemInferface: DashItemInterface = { item: DashItem -> item.foo() }
    It signals as a type mismatch, saying it was expecting an instance of an implementation of the interface rather than a
    (DashItem) -> Unit
    . Am I doing it wrong somehow?
    d
    • 2
    • 2
  • h

    Hullaballoonatic

    08/29/2018, 6:43 PM
    mind if i dm about it?
    k
    • 2
    • 2
  • a

    Ayden

    08/30/2018, 6:28 AM
    @diesieben07 can I consider this syntax
    ->
    in lamdas as return?
    d
    e
    s
    • 4
    • 18
  • o

    otakusenpai

    08/31/2018, 9:43 AM
    thnx
    k
    n
    • 3
    • 3
  • m

    muralimohan962

    09/02/2018, 5:40 AM
    Hey! How do i access anonymous classes in enum constants?
    a
    s
    • 3
    • 4
  • m

    mattray

    09/02/2018, 9:16 PM
    Any one have tips for a noob? I’m getting started with the docs and really want to pour some time into learning this language.
    k
    n
    u
    • 4
    • 3
  • o

    oday

    09/03/2018, 2:49 PM
    not sure how to turn List to ArrayList 🤔
    t
    • 2
    • 1
  • t

    todd.ginsberg

    09/03/2018, 2:59 PM
    That way, you can use whatever implementation of List you find handy or appropriate.
    k
    • 2
    • 1
  • d

    drfidel

    09/03/2018, 3:20 PM
    Some tips on date operations in kotlin....difference between dates adding a number of days to a particular date
    :google: 1
    d
    • 2
    • 4
  • o

    oday

    09/03/2018, 3:27 PM
    nah it’s not the same
    s
    s
    • 3
    • 8
  • p

    Pavan Kuppa

    09/06/2018, 11:33 AM
    How can i start contributing to kotlin language? Any tips would be accepted please..
    i
    • 2
    • 1
  • a

    aglassman

    09/07/2018, 3:07 PM
    Is it possible to allocate a ByteArray larger than Int.MAX_VALUE ?
    d
    • 2
    • 2
  • h

    Hullaballoonatic

    09/08/2018, 5:37 PM
    just trying to make a generic uniform cost search algorithm
    k
    • 2
    • 39
  • v

    ValV

    09/09/2018, 3:54 AM
    @hudsonb Yes, that did the trick, thanks. This solved the problem (for initial example in Java):
    import tornadofx.*
    class MyClass {
      var myObservableProperty = SimpleStringProperty()
      var myObservable by myObservableProperty
    }
    and
    val myClass = MyClass()
    val property = myClass.myObservableProperty
    myClass.myObservable = "New data"
    println(myClass.myObservable)
    Yeah, I love Kotlin 😃
    b
    • 2
    • 2
  • k

    karelpeeters

    09/09/2018, 9:35 PM
    Too bad the optimization isn't that smart:
    var mainCount = 0
    mainCount++
    
    thread {
        while( true ) {
            println(mainCount)
            Thread.sleep(1000)
        }
    }
    could work without reference too, but the compiler generates it anyway.
    s
    • 2
    • 5
  • p

    poohbar

    09/10/2018, 1:37 PM
    Is there an equivalent of
    check
    that would take a supplier lambda for the case when the check passes?
    a
    n
    +2
    • 5
    • 20
  • h

    Hullaballoonatic

    09/10/2018, 11:43 PM
    val bb = terrain!![posRed + 1] and 0xff.toByte()
    val gg = terrain[posRed + 2] and 0xff.toByte()
    val rr = terrain[posRed + 3] and 0xff.toByte()
    g.color = Color(rr.toInt(), gg.toInt(), bb.toInt())
    i
    v
    • 3
    • 6
  • k

    karelpeeters

    09/11/2018, 4:38 PM
    to
    is a factory function for pairs, there's no inherent connection to maps.
    s
    n
    • 3
    • 20
  • v

    ValV

    09/11/2018, 5:01 PM
    How do I write a "launcher" class for TornadoFX app to be able to run it from jar-file? I have tried to use Maven's (I'm using Maven)
    maven-jar-plugin
    configuration to generate MANIFEST.MF file with
    Main-Class
    entry, it does but with no success - TornadoFX app class is inherited from
    Application
    and has no static
    main
    method
    s
    h
    • 3
    • 6
  • h

    Hullaballoonatic

    09/11/2018, 9:54 PM
    how do I instantiate an iterator in kotlin? every iterator is an interface
    a
    n
    • 3
    • 11
  • h

    Hullaballoonatic

    09/11/2018, 10:37 PM
    why is it suggested i also override
    hashCode()
    for a class whenever i override
    equals()
    ? I don't even know what the former does
    r
    • 2
    • 1
  • h

    Hullaballoonatic

    09/11/2018, 10:39 PM
    i presume equals() also compares hashCode values, meaning i should only include values in the hashCode function that i depend on in the equals function?
    t
    s
    • 3
    • 2
  • n

    Nikky

    09/11/2018, 11:14 PM
    the infix function
    to
    operates on parametrized types.. so that might be a example from the stblib you want to look at
    h
    • 2
    • 2
Powered by Linen
Title
n

Nikky

09/11/2018, 11:14 PM
the infix function
to
operates on parametrized types.. so that might be a example from the stblib you want to look at
h

Hullaballoonatic

09/11/2018, 11:42 PM
Yeah, I use many extension functions, but creating extension functions for infix doesn't seem possible since aren't they required to be within a class body?
nvm! works
👍 1
View count: 4