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

    Patrick Inshuti Makuba

    03/29/2018, 1:15 PM
    Hello guys, I am new to Kotlin. And i wanted to create an android app with a good backend in mysql. At this point what do i need to know/learn to achieve this? Thanks
    a
    2 replies · 2 participants
  • e

    Egor Trutenko

    03/30/2018, 2:27 PM
    Imo, Java is not great, not a little. Java is actually the very "shit that we had before Kotlin", because initially there was Java and something for enterprise in like far XX, and then it was just cheaper for enterprise. Let's be honest,the way how java does operate on the memory and other things is terrible. The world was just waiting for the age of finally good languages which a lot of people work on and it's a pleasure to use them.
    b
    1 reply · 2 participants
  • b

    bigkahuna

    03/30/2018, 6:14 PM
    I don't think lack of types is a drawback to Clojure. Maybe if you're a programmer who's used to static types, the lack of "typing" can be a big shock to the system. Clojure works in a different way so what you thought you would do with types can be achieved with multimethods and protocols. Furthermore with Clojure 1.9 you know have Clojure.Spec which allows you to specify the expected behaviour of a function with respect to the datatypes passed in or out so you get the advantages of static whilst still having dynamic typing. I say this as a current Java/Kotlin programmer who also uses Clojure. Just a different way to achieve the same objective.
    s
    p
    +1
    11 replies · 4 participants
  • s

    Shawn

    03/30/2018, 9:46 PM
    I don’t wanna be that guy, but we’ve been on this Clojure discussion in #getting-started for a while now - might be worth instead @’ing someone you wanna respond to in #random or using a :thread-please:
    r
    1 reply · 2 participants
  • m

    miha-x64

    03/31/2018, 3:11 PM
    Which is the correct way of documenting getter & setter separately?
    var value: T
        /**
         * Returns current value.
         */
        get <-- 'redundant getter'
        /**
         * Changes value and notifies listeners. Will break current binding, if any.
         */
        set <-- 'redundant setter'
    UPD: found: https://youtrack.jetbrains.com/issue/KT-17962
    o
    n
    5 replies · 3 participants
  • j

    joe_androidsecurity

    04/02/2018, 7:57 PM
    I have a silly question. I am trying to code a small app/script where I parse a Json and play with it. Json is very deep. in Python I can do something like pages = json["document"]["children"][0][0] Is there a way to do and simplify something like that in Kotlin, too? I am using kttp Library so I have a JSOnObject.
    m
    2 replies · 2 participants
  • b

    bj0

    04/02/2018, 8:06 PM
    so you would just
    json.get("document")
    , etc
    j
    2 replies · 2 participants
  • b

    bj0

    04/02/2018, 8:10 PM
    but you have to be explicit about your types, since java/kotlin are statically typed...
    s
    1 reply · 2 participants
  • z

    zucen.co

    04/03/2018, 7:12 AM
    Hi, more about best practice.. when i do not need to do Utils class to hold functions now.. What is prefered way to keep those methods? You make one .kt file in project package and put all functions there?
    l
    2 replies · 2 participants
  • r

    Rak

    04/04/2018, 11:36 AM
    now I’m working on a pure kotlin codebase, what should i do?
    d
    h
    +1
    7 replies · 4 participants
  • k

    Konstantin Petrukhnov

    04/04/2018, 11:38 AM
    what would be the good way to implement interface that have method getName(), abstract class that implement that method, and normal class that extend abstract, and actually have specific name? Name is just string field.
    d
    1 reply · 2 participants
  • l

    Lunzi

    04/05/2018, 6:31 AM
    how can i return a file to rest API with spring boot?
    l
    n
    2 replies · 3 participants
  • j

    jinbeom hong

    04/05/2018, 8:32 PM
    What is difference between them as follows:
    val sum: Int.(Int) -> Int = { other -> plus(other) }
    val sum = fun Int.(other: Int): Int = plus(other)
    According to document(https://kotlinlang.org/docs/reference/lambdas.html#function-literals-with-receiver), when i use anonymous function,
    The anonymous function syntax allows you to specify the receiver type of a function literal directly. This can be useful if you need to declare a variable of a function type with receiver, and to use it later.
    . What does it mean? Why do i can’t use a variable of function type(not anonymous function but
    val intPlus: Int.(Int) -> Int = Int::plus
    ) later?
    d
    k
    6 replies · 3 participants
  • z

    zucen.co

    04/07/2018, 8:15 AM
    Hey guys, i am exploring kotlinx form html generation. Pls.. is this still kind of life way to do it? I mean I can not find to much resources online on it..?
    k
    2 replies · 2 participants
  • s

    stephan_marshay

    04/09/2018, 7:11 PM
    try:
    fun isValidGender(gender: Int): Boolean {
         return gender == PetEntry.GENDER_UNKNOWN || gender == PetEntry.GENDER_MALE || gender == PetEntry.GENDER_FEMALE
     }
    k
    2 replies · 2 participants
  • q

    quocdev

    04/10/2018, 3:41 AM
    Hey guy Any body share me the project like the https://github.com/JetBrains/kotlinconf-app Thanks you
    a
    3 replies · 2 participants
  • t

    Thanos Psaridis

    04/11/2018, 7:16 AM
    Guys is it a good practice to just throw all my data classes in a single file?
    h
    n
    8 replies · 3 participants
  • d

    diesieben07

    04/11/2018, 9:27 AM
    Your package statement must match the location of the file. If your package is "com.example.app" then your class files must be located at "com/example/app/MyClass.class" (same is recommended for .kt files).
    s
    2 replies · 2 participants
  • s

    Surya Poojary

    04/11/2018, 3:43 PM
    But what is a Null
    a
    1 reply · 2 participants
  • s

    Slackbot

    04/11/2018, 6:38 PM
    This message was deleted.
    k
    z
    2 replies · 3 participants
  • s

    SiebelsTim

    04/12/2018, 6:48 AM
    generateCmponent
    does not return anything. Then look at the call-order.
    generateCmponent
    is called first, adding the table. After that, the body is generated. I would suggest that you return your table from the
    generateCmponent
    function and not append the writer.
    z
    7 replies · 2 participants
  • o

    otakusenpai

    04/14/2018, 1:49 PM
    ok i will
    s
    2 replies · 2 participants
  • o

    otakusenpai

    04/14/2018, 1:49 PM
    are there any good regex books?
    k
    2 replies · 2 participants
  • k

    karelpeeters

    04/14/2018, 4:24 PM
    filter
    doesn't remove items, it creates a new list. I believe there's something like
    .removeIf
    s
    2 replies · 2 participants
  • k

    karelpeeters

    04/15/2018, 1:41 PM
    I don't think there's anythin in the collection apis that operates on reference equality.
    d
    b
    3 replies · 3 participants
  • m

    mtl

    04/16/2018, 12:14 PM
    Hi, decided to get into Kotlin properly today, but I cannot get the build to work, I am not coming from a Java background so am not familiar with gradle, but it seems somewhat painful for simple things. In particular, I am getting
    Could not determine Java version using executable /usr/lib/jvm/java-10-openjdk/bin/java
    - not really sure how it's impossible to determine the JDK version from that. EDIT: Looks like https://github.com/gradle/kotlin-dsl/issues/816 i.e. Gradle, Kotlin and OpenJDK 10 don''t play nicely together
    a
    m
    3 replies · 3 participants
  • h

    holgerbrandl

    04/17/2018, 7:41 AM
    Thanks @marstran, but if
    Unit
    is the
    void
    equivalent, why is it assignable in kotlin but not in java?
    r
    2 replies · 2 participants
  • d

    diesieben07

    04/18/2018, 8:59 AM
    That's the high-level explanation,
    Nothing
    can also be used in other ways, especially in combination with generics.
  • l

    Loránd

    04/18/2018, 8:59 AM
    Do you have an example of how it can be used with generics? @diesieben07
    d
    2 replies · 2 participants
  • k

    karelpeeters

    04/18/2018, 6:19 PM
    Why won't it let you pass
    this
    ?
    m
    2 replies · 2 participants
Powered by Linen
Title
k

karelpeeters

04/18/2018, 6:19 PM
Why won't it let you pass
this
?
m

mbickel

04/19/2018, 10:25 AM
The error says the type signature is
KProperty1<out Site, Any?>
, so it won't let me pass
this
(of type Site) to a function call. But the interface for KProperty1 says the out param is the second one? That's so confusing.
Apparently, you can do
prop.getter.call(this)
for public properties, which mine unfortunately isn't.
View count: 2