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

    poohbar

    05/31/2018, 1:17 PM
    There are only two places in my pom that say `1.8`:
    <properties><java.version>1.8</java.version></properties
    and in
    kotlin-maven-plugin
    <jvmTarget>1.8</jvmTarget>
    a
    • 2
    • 2
  • c

    Conrad

    05/31/2018, 3:31 PM
    you wager it's possible to code something shoddy up in 6-7 days
    s
    n
    +2
    • 5
    • 76
  • k

    karelpeeters

    06/04/2018, 8:01 AM
    What's the bug actually?
    d
    • 2
    • 2
  • p

    Pavlo Liapota

    06/04/2018, 11:11 AM
    How about this?
    enum class Direction {
        NONE,
        NORTH, 
        SOUTH, 
        EAST, 
        WEST, 
        START, 
        END;
        
        companion object {
            private val oppositMap = mapOf(
                SOUTH to NORTH,
                NORTH to SOUTH
                // ...
            )
        }
    
        val opposit get() = oppositMap.getValue(this)
    }
    z
    d
    +5
    • 8
    • 54
  • k

    karelpeeters

    06/04/2018, 3:31 PM
    So use 3 (I think you can even reuse the name) or try
    user?.let { ... }
    a
    • 2
    • 2
  • r

    rook

    06/04/2018, 4:13 PM
    You can use it that way, but you don’t actually invoke the caller, so I don’t see the point in extending the
    Date
    class
    ➕ 1
    z
    a
    • 3
    • 11
  • a

    aromal.s

    06/06/2018, 11:55 AM
    anyone have tried angular 5 and kotlin(instead of typescript)?
    k
    • 2
    • 2
  • c

    crazdrms

    06/07/2018, 1:06 AM
    how can i implement this in kotlin ''' public class GitHubActionCreator extends RxActionCreator implements Actions { /** * If you want to give more things to the constructor like API or Preferences or any other * parameter you can buy make sure to call super(dispatcher, manager) */ public GitHubActionCreator(Dispatcher dispatcher, SubscriptionManager manager) { super(dispatcher, manager); }'''
    p
    • 2
    • 2
  • r

    rook

    06/07/2018, 5:53 PM
    Have you tried just starting a brand new kotlin project in IDEA and seeing if that just works? If that doesn’t work, then there’s a deeper issue. If that does work, then it’s a Gradle configuration issue.
    👍 1
    d
    • 2
    • 6
  • n

    ncardozo

    06/07/2018, 11:24 PM
    Hi, I just downloaded intelliJ and installed the EduTools plugin, but I cant check my tasks. I get the failed to launch checking error. Does anyone know what might be the problem ?
    n
    k
    • 3
    • 4
  • v

    Viktor Poulsen

    06/08/2018, 10:33 AM
    So a seperate model for auth perhaps?
    r
    • 2
    • 2
  • h

    Hamza

    06/10/2018, 2:55 AM
    i’ve been trying to get into web applications, but ihave found no luck. everything has such a high learning curve What do you guys recomend?
    s
    t
    • 3
    • 71
  • h

    Hamza

    06/10/2018, 7:02 AM
    fun <T> example(type: T)...
    z
    • 2
    • 6
  • a

    Andreas Sinz

    06/10/2018, 8:41 AM
    @zucen.co the
    justFunction
    will be compiled into two different methods. Thats not really possible with lambdas or local functions, because you have only one
    val singleParamFun
    z
    k
    • 3
    • 4
  • d

    dave08

    06/12/2018, 1:39 PM
    I need something like
    fun getPartRanges(partSize: Long, totalSize: Long): List<LongRange>
    that returns something like [0..20,21..40,41..60,61..74] for an input of
    partSize = 20
    and
    totalSize = 74
    , what is an ideomatic way to do this in Kotlin?
    r
    k
    • 3
    • 15
  • h

    Hullaballoonatic

    06/12/2018, 2:46 PM
    Dave, I hate your avatar so much
    ⭕ 1
    👍 1
    👎 1
    d
    • 2
    • 3
  • h

    Hullaballoonatic

    06/12/2018, 4:06 PM
    Is it possible to instantiate a class and dynamically extend it to different interfaces based on a variable dictating which?
    a
    • 2
    • 3
  • h

    Hullaballoonatic

    06/12/2018, 4:08 PM
    how is kotlin so much faster than java while using the same bytecode?
    a
    p
    +2
    • 5
    • 11
  • d

    diesieben07

    06/12/2018, 7:59 PM
    Arrays are not really a collection. Arrays are a low level data-structure building block
    s
    h
    • 3
    • 3
  • d

    diesieben07

    06/12/2018, 8:04 PM
    Any old text editor will do 😛
    s
    h
    s
    • 4
    • 5
  • h

    Hullaballoonatic

    06/12/2018, 8:07 PM
    but i don't think visual studio does kotlin well, does it? i know android studio does, but ho boy that ide is hefty as fuck
    s
    • 2
    • 2
  • h

    Hullaballoonatic

    06/12/2018, 8:10 PM
    i can't really compare. i've never coded on a mac before. i do on some linux builds from time to time, but nothing specialized. i imagine there's a lot to be said for why so many programmers prefer to do it on macs
    d
    s
    • 3
    • 30
  • u

    ursus

    06/13/2018, 8:50 PM
    however that disallows me to make private val sipManager and callStatusManager
    e
    • 2
    • 2
  • a

    al

    06/15/2018, 1:07 AM
    Trying the koans, is there a difference between the two lines???
    val whatisthis = customers.flatMap { it.orders }.flatMap { it.products }
        val allProducts = customers.flatMap { it.orders.flatMap { it.products } }
    Thanks in advance, I did compare and it says they are the same
    println(whatisthis == allProducts)
    k
    • 2
    • 2
  • b

    benleggiero

    06/15/2018, 1:38 AM
    Is there any way to call `super`’s initializer in
    init
    ?
    s
    a
    • 3
    • 5
  • i

    ilya.gorbunov

    06/15/2018, 5:03 PM
    @Nicole There's a couple of posts explaining their difference, try searching "Kotlin let apply also". IMO this table summarizes it at glance https://docs.google.com/spreadsheets/d/1P2gMRuu36pSDW4fdwE-fLN9fcA_ZboIU2Q5VtgixBNo
    n
    k
    • 3
    • 4
  • d

    dalexander

    06/15/2018, 7:01 PM
    https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/windowed.html maybe this will do what you want? Otherwise consider non-FP solutions, they are easier to read for some kinds of problems.
    z
    h
    • 3
    • 7
  • h

    Hullaballoonatic

    06/15/2018, 8:52 PM
    i'll go back and do that
    z
    • 2
    • 1
  • h

    Hullaballoonatic

    06/15/2018, 9:58 PM
    Are there any outs for removing the error, though?
    d
    • 2
    • 28
  • s

    Sudhir Singh Khanger

    06/16/2018, 8:31 AM
    Seems like this is happening because of the way I have declared the variable. Doesn't works -
    private lateinit var movieAdapter: RecyclerView.Adapter<*>
    Works -
    val movieAdapter = MovieAdapter(...)
    d
    • 2
    • 1
Powered by Linen
Title
s

Sudhir Singh Khanger

06/16/2018, 8:31 AM
Seems like this is happening because of the way I have declared the variable. Doesn't works -
private lateinit var movieAdapter: RecyclerView.Adapter<*>
Works -
val movieAdapter = MovieAdapter(...)
d

diesieben07

06/16/2018, 2:41 PM
I suspect generics are at play here. Your 2nd variable gets the inferred type
MovieAdapter
, not
RecyclerView.Adapter<*>
.
View count: 1