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

    sdavids

    02/09/2017, 5:44 AM
    Now, I could do something like:
    constructor(vararg cells: Cell, f: (List<T>) -> T)
    but then the lambdas would go from
    { x, y -> x + y }
    to something like
    { it[0] + it[1] }
    which I guess would be ok, but not the most readable.
    m
    • 2
    • 2
  • t

    tauraamui

    02/09/2017, 9:43 AM
    are there good resources to learn about generics in Kotlin, apart from the documentation (since it normally doesn't have examples xD, I think)
    👍 1
    v
    v
    • 3
    • 2
  • k

    koufa

    02/09/2017, 1:47 PM
    How can I get the classloader in Kotlin?
    r
    • 2
    • 1
  • p

    pentarex

    02/09/2017, 2:48 PM
    hey guys... I have a question. how's that expression translated to kotlin -> Set selectedValues = new HashSet();
    m
    • 2
    • 2
  • s

    sreich

    02/09/2017, 3:54 PM
    At least I do 😀
    m
    • 2
    • 7
  • s

    sksk

    02/09/2017, 6:44 PM
    oh i found it
    C:\Users\scellow\AppData\Local\JetBrains\Toolbox\apps\IDEA-U\ch-0\171.2822.15\plugins\Kotlin\kotlinc\bin
    m
    • 2
    • 4
  • e

    Eugenio

    02/09/2017, 10:38 PM
    hey everyone, I published a thing, I hope you find it useful: https://medium.com/@workingkills/pushing-the-limits-of-kotlin-annotation-processing-8611027b6711#.qb5vgokb3
    m
    • 2
    • 1
  • e

    ehonsey

    02/09/2017, 11:35 PM
    Has anyone seen a bug on type inference for java classes with same short names? I don't want to file a duplicate bug. However I had an issue assigning a field with type of
    java.sql.Date
    . Although I have an import for that class in the calling class, when I call
    Date.from(Instant)
    the compiler is inferring
    java.util.Date
    instead of
    java.sql.Date
    . I had to give a type hint. I would have expected the compiler to make this inference based on the type of the target field.
    i
    • 2
    • 8
  • m

    mfulton26

    02/10/2017, 3:37 PM
    Can't you inject it though using the Android Manifest file? http://stackoverflow.com/questions/2002288/static-way-to-get-context-on-android
    m
    • 2
    • 2
  • m

    martyglaubitz

    02/10/2017, 3:40 PM
    @mfulton26 you can get the context from pretty much everywhere, views, fragments, services, boradcast receivers… why risking a context leak?
    👍 1
    m
    • 2
    • 1
  • d

    danneu

    02/11/2017, 6:00 AM
    last one is the simplest
    fun <T> Iterable<T>.batch(chunkSize: Int) = this
            .mapIndexed { i, item -> i to item }. // create index value pairs
            .groupBy { it.first / chunkSize }.    // create grouping index
            .map { it.value.map { it.second } }   // split into different partitions
    ❤️ 1
    m
    • 2
    • 1
  • r

    rrader

    02/11/2017, 10:57 AM
    Hi, are there some tools to check tests coverage in Kotlin?
    e
    • 2
    • 2
  • c

    carrot

    02/11/2017, 9:29 PM
    Hi all, is there a way to turn off the Kotlin compiler daemon with a Gradle property or something? It doesn't play nicely with CI it seems
    m
    • 2
    • 3
  • o

    oliverdain

    02/12/2017, 1:21 AM
    I’ve got a Java library that declares several subclasses of type
    ClassifierTrainer<double[]>
    I need to assign any such subclass to a Kotlin variable but can’t figure out a type that works. The obvious
    ClassifierTrainer<Array<Double>>
    fails. Anyone know the right way to do this?
    a
    • 2
    • 6
  • s

    sreich

    02/13/2017, 10:06 AM
    Again, you're arguing preference. A fruitless discussion
    r
    • 2
    • 5
  • s

    Slackbot

    02/13/2017, 2:17 PM
    This message was deleted.
    a
    • 2
    • 1
  • v

    vlastachu

    02/13/2017, 2:53 PM
    I prefer
    class A: B {}
    😱 6
    m
    • 2
    • 2
  • k

    kzotov

    02/14/2017, 10:04 AM
    So what about future of back-end kotlin development compare to Java 9?
    s
    • 2
    • 1
  • g

    gildor

    02/14/2017, 10:25 AM
    Hmm, just discovered that smart cast doesn’t work for `obj::class.java`: http://try.kotlinlang.org/#/UserProjects/35drpmirdvt073pkk3s5nfsn8v/7v6kraquqm6trj9rjs0gj8erts Maybe anybody knows the reason of that
    👍 1
    🤔 1
    k
    m
    • 3
    • 4
  • b

    bernhard

    02/14/2017, 5:52 PM
    however, syntax for assigning val inside of an if condition would be quite helpful in cleaning up code, specially when used in some
    if-else if-else
    constructs
    m
    • 2
    • 8
  • s

    sreich

    02/15/2017, 12:04 AM
    am i abusing 'by lazy' by having it be a property assigned to applicationContext (android). such that, in this entire file..if the context isn't up, you're kinda screwed anyway
    m
    • 2
    • 2
  • k

    kirillrakhman

    02/15/2017, 5:10 PM
    sometimes you don't have a linenumber like in an empty catch clause. however that doesn't really answer the question about inline
    m
    • 2
    • 3
  • d

    dmnk_89

    02/16/2017, 3:56 PM
    there is free history without limits for this slack - http://kotlinlang.slackarchive.io/
    m
    • 2
    • 2
  • e

    eugene.kudelevsky

    02/16/2017, 4:55 PM
    Hi. I'm getting "Error:Kotlin: Source file or directory not found: " when trying to compile Kotlin.JS project. It is imported from Maven. What can be wrong with it?
    b
    • 2
    • 4
  • g

    groostav

    02/16/2017, 10:19 PM
    does anybody have a good intro to properties for 100% java programmers?
    m
    s
    • 3
    • 13
  • k

    kevinherron

    02/16/2017, 11:30 PM
    i am so sick of the braindead kotlin refactor -> rename that just replaces any text occurrence across the entire project
    💯 2
    t
    v
    • 3
    • 7
  • m

    mg6maciej

    02/17/2017, 10:54 AM
    @elect Download and install manually: https://plugins.jetbrains.com/idea/plugin/6954-kotlin
    e
    • 2
    • 1
  • o

    orangy

    02/17/2017, 11:19 AM
    @yawkat please report verifyError to kotl.in/issue, as for slow compilation, we would need something we can profile.
    y
    • 2
    • 2
  • o

    orangy

    02/17/2017, 3:17 PM
    If early exit is not required, something like this:
    val a = listOf("a")
        val b = listOf("A")
        a.size == b.size && a.foldIndexed(true) { index: Int, acc: Boolean, s: String -> acc && b[index].equals(s, true)}
    i
    • 2
    • 3
  • v

    vlastachu

    02/17/2017, 3:20 PM
    a.zip(b, {x,y -> x.value.equals(y.value) })
    aw... there should be
    all()
    .
    i
    • 2
    • 1
Powered by Linen
Title
v

vlastachu

02/17/2017, 3:20 PM
a.zip(b, {x,y -> x.value.equals(y.value) })
aw... there should be
all()
.
i

ilya.gorbunov

02/17/2017, 3:23 PM
vlastachu: This won't detect the situation when
a
and
b
differ in size
View count: 2