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
feed
  • m

    Mario Fernandez

    04/23/2020, 5:10 PM
    I’ve done a lot of advocating of
    Kotlin
    and
    arrow
    this past months internally at ThoughtWorks, and an article of mine featuring
    Either
    just got published 😛 https://www.thoughtworks.com/insights/blog/either-data-type-alternative-throwing-exceptions
    😍 1
    👏 2
    r
    • 2
    • 1
  • r

    Robert Jaros

    04/25/2020, 12:56 PM
    KVision 3.7.1 (bugfix release) is out. https://github.com/rjaros/kvision/releases/tag/3.7.1
    👍 1
    a
    • 2
    • 1
  • e

    elizarov

    04/25/2020, 8:37 PM
    Running into StackOverflowError but have a lot of heap space to keep the state of your computation? Kotlin Coroutines can help https://medium.com/@elizarov/deep-recursion-with-coroutines-7c53e15993e3
    🤯 1
    👍 25
    😒uspend: 5
    👌 1
    ❤️ 5
    c
    j
    • 3
    • 4
  • d

    Dan Newton

    04/27/2020, 8:25 AM
    Continuing my intro series to coroutines - https://lankydan.dev/waiting-for-coroutines
    👍 2
    b
    • 2
    • 2
  • e

    elye

    05/04/2020, 10:43 AM
    https://medium.com/@elye.project/kotlins-elvis-better-than-swift-s-guard-53030d403c3f?source=friends_link&sk=bf7fced446cc161095a9d281054fb927
    :kotlin: 1
    🤔 1
    👍 2
    m
    t
    +2
    • 5
    • 8
  • s

    stevecstian

    05/04/2020, 2:02 PM
    Kotlin 4 vs. Scala 3:

    https://youtu.be/sIL4mduqHe0▾

    ❤️ 1
    z
    m
    +4
    • 7
    • 10
  • b

    Bhavdipb

    05/05/2020, 12:21 PM
    Hello Guys,
    google-ads
    in library for my some use. but I dont want to expose that usage. What I mean is I am taking advertisementId but I don't want to tell library user/developer. When calling class from library that internally use
    google-ads
    and doing network call from library. but not using that dependency to app so it is crashing of
    NoClassFoundException
    and library user/developer must have to add
    gms:play-services-ads
    . That I dont want 😞 https://stackoverflow.com/questions/61521343/library-dependency-class-use-in-app-android?noredirect=1#comment108827004_61521343
    n
    • 2
    • 1
  • k

    Kris Wong

    05/06/2020, 4:11 PM
    my post on publishing/consuming KMP artifacts to/from maven has been published: https://medium.com/vmware-end-user-computing/publishing-kotlin-multiplatform-artifacts-to-artifactory-maven-a283ae5912d6
    👏 2
    s
    • 2
    • 1
  • p

    pablisco

    05/06/2020, 5:10 PM
    We are live with Kotlin London, but open to people from everywhere 🙂 https://twitter.com/KotlinLondon/status/1258081328639213568 With @danieeh now and @aballano after
    👏 7
    d
    a
    • 3
    • 2
  • r

    Robert Jaros

    05/10/2020, 1:38 AM
    I've released KVision 3.8.0 - https://github.com/rjaros/kvision. Highlights of this release: - added new
    className
    parameter to all DSL builder functions for better React-like HTML markup - simplified state binding functions - added root panel container types from Bootstrap 4.4 - upgraded dependencies: Coroutines 1.3.6, Spring Boot 2.2.7, Jooby 2.8.2, Bootstrap Select 1.13.17 For more details about this release see the changelog. As always any feedback is welcomed :-)
    a
    • 2
    • 13
  • e

    elizarov

    05/10/2020, 7:54 AM
    Have you ever wondered why a coroutine context is immutable and a mutex is non-reentrant? It turns out, both are corollary to the same basic rule: https://medium.com/@elizarov/phantom-of-the-coroutine-afc63b03a131
    😒uspend: 6
    👍 8
    k
    • 2
    • 1
  • d

    Dan Newton

    05/12/2020, 8:07 AM
    A continuation of the getting started with coroutines series i have been writing - https://lankydan.dev/cancelling-coroutines
    👍 1
    s
    • 2
    • 8
  • s

    Stanislav Kozlovski

    05/14/2020, 3:00 PM
    Just had my latest piece on Kotlin’s lack of
    package-private
    published: https://levelup.gitconnected.com/kotlin-unit-testing-classes-without-leaking-public-api-871468695447 I’m sure you’re all aware of it, but I thought I’d share 🙂
    t
    c
    k
    • 4
    • 6
  • a

    Abhishek Bansal

    05/17/2020, 7:22 AM
    Recently I said my goodbyes to Gson for good. Here is why I ditched beloved Gson for my Kotlin projects https://link.medium.com/QcWFLQLuy6
    👍 4
    e
    • 2
    • 1
  • p

    pjagielski

    05/17/2020, 9:45 PM
    I just released 0.2.0 version of PunKt: live music coding library for Kotlin, now with effects support 🎶🎹🎛️ You can use it to make beats straight from Intellij, check also longer demo:

    https://youtube.com/watch?v=OdQQJPpL6Lo&t=138s▾

    da-punkt-fx-short.mp4
    👏 13
    🎶 16
    :kotlin: 6
    😎 5
    🎉 24
    a
    • 2
    • 2
  • s

    Shabih Syed

    05/22/2020, 5:53 PM
    Hi there! We at mParticle  recently released a new open source product called Smartype. Built on Kotlin, it generates type-safe code for multiple platforms working off a common JSON data model. Since we help companies collect customer data from mobile, web and OTT apps, enforcement of a standardized data collection strategy is of utmost importance. Otherwise, you get all sorts of data quality issues downstream wherever customer data events and attributes are forwarded. Smartype helps developers manage data quality by enforcing a standardized data collection strategy and by collaborating with PMs and Marketers through an API that offers all CRUD operations vs. ever going to the mParticle User Interface. Next Wednesday, May 27th, at 10am PDT/1pm EDT, we'll be broadcasting live on Linkedin to discuss the challenges of managing data quality, and how developers and PM teams can leverage mParticle's new Smartype feature. Follow mParticle to get a notification when we go live. Would love for anyone to join to learn, play with it on their own time and give us feedback.
    👌 2
    👍 2
    r
    • 2
    • 1
  • e

    elye

    05/24/2020, 7:03 AM
    https://medium.com/@elye.project/understand-kotlin-collection-function-past-tense-59f592af9436?source=friends_link&sk=e22ccd272ebd28ef6f417e7b455b5b4f
    👍 1
    m
    • 2
    • 1
  • i

    iguissouma

    05/25/2020, 1:05 PM
    I've created a simple Graphql WhatsApp-(K)lone-Server for learning using
    kotlin
    ,
    spring-boot
    ,
    graphql-kotlin
    ,
    r2dbc
    ,
    postgres
    . If any one want take a look. A compatible frontend in React is available here. this is inspired by WhatsApp-Clone-Server implmented in TypeScript and Apollo Graphql Server.
    👍 1
    s
    • 2
    • 4
  • z

    zsmb

    05/25/2020, 5:39 PM
    Wrote a bit about representing view state as a single object. Learn how to design your state classes, and how to actually use them in practice - lots of small tips in this one! Designing and Working with Single View States on Android https://zsmb.co/designing-and-working-with-single-view-states-on-android/
    👏 4
    👍 11
    a
    c
    +4
    • 7
    • 19
  • g

    gammax

    05/27/2020, 1:36 PM
    Sharing a Kotlin Github template to write Gradle :gradle: Plugins here: https://github.com/cortinico/kotlin-gradle-plugin-template It’s 100% :kotlin:, uses composite builds to let you use the plugin directly in the example project, has detekt/ktlint setup, and has publishing to Gradle Portal via Github Actions 🚀
    😬 1
    :kotlin: 1
    💯 11
    e
    • 2
    • 1
  • a

    amanda.hinchman-dominguez

    05/27/2020, 5:18 PM
    @raulraja is giving a live talk on the new Type Proofs plugin for Arrow-meta now streaming on Youtube - check it out 🤗 http://www.youtube.com/watch?v=lK80dPcsNUg
    :arrow: 8
    :kotlin-flag: 11
    n
    t
    • 3
    • 8
  • s

    sdeleuze

    05/28/2020, 1:02 PM
    FYI I have released Spring Fu 0.3.0 (with KoFu Kotlin experimental DSL for Spring Boot) and shared some insights about the roadmap https://spring.io/blog/2020/05/28/spring-fu-0-3-0-and-beyond
    👍 18
    🎉 7
    t
    n
    +2
    • 5
    • 31
  • j

    jaguililla

    05/29/2020, 3:13 PM
    TechEmpower just released their latest round (19) of their server middleware benchmark. You can check the results here: https://www.techempower.com/benchmarks
    z
    a
    +3
    • 6
    • 22
  • h

    Hari Kulhari

    06/05/2020, 9:47 AM
    #30DaysOfKotlin https://github.com/HariKulhari06/Covid-19-Tracker Create an Android application to display Covid-19 statistics of Indian and globally.
    👏 4
    h
    • 2
    • 2
  • m

    Marcin Wisniowski

    06/05/2020, 3:59 PM
    Hello! I released AutoKonfig, a Kotlin library for configuration files (and command line arguments) with many features I hope are useful and a goal to make it "just work" while being very simple to use. Zero lines of code required for setup, get values from your config file right away. https://autokonfig.nohus.dev/
    👍 5
    d
    x
    +2
    • 5
    • 7
  • o

    Oscar Sequeiros

    06/08/2020, 12:19 PM
    Hello World! I've just written a post about MVI, State Machine and Jetpack Compose. 🔄 🎰 :android: https://medium.com/@OscarSequeiros/mvi-state-machine-and-jetpack-compose-74bba0283f07
    n
    • 2
    • 1
  • r

    raulraja

    06/09/2020, 10:56 PM
    In our new 47 Degrees Academy launch we are gonna cover many topics including Kotlin extensively. The first talk is by @Jorge Castillo this Thursday at 18:00 CET “Async and concurrent error handling and cancellation” with #arrow Fx Coroutines https://twitter.com/47deg/status/1270379984557768705
    ❤️ 4
    👍 3
    :kotlin: 5
    :arrow: 4
    🤘 13
    n
    • 2
    • 1
  • s

    Stephan Schroeder

    06/10/2020, 1:32 PM
    So I wrote a library for csv-parsing in Kotlin called KSV: https://github.com/whichdigital/ksv The problem we had at 'Which?' was that we regularly import government data in ever-slightly-changing csv-format (e.g. changed order of columns, new columns at arbitrary position and column names with changing lower/uppercase and sometimes with additional spaces). So this solution looks doesn't use the index of data (because that kept changing), but uses the (normalized) column names in its mapping. A
    csv2List
    -function is used to map an InputStream containing csv-text into a list of a user-defined data class. Strong type guarantees, including nullability and user-defined property types are provided (as well as common csv-features like
    ,
    being allowed in csv-values if those are surrounded by quotation marks).
    @CsvRow data class DataRow(
        @CsvValue(name = "RQIA") val id: String,
        @CsvValue(name = "Number of beds") val bedCount: Int?,   // types can be nullable
        val addressLine1: String,                                // without annotation it's assumed the the column name is the the property name
        val city: String = "London",                             // without value in the csv file the Kotlin default value is used
        @CsvTimestamp(name = "latest check", format = "yyyy/MM/dd|dd/MM/yyyy")  
        val latestCheckDate: LocalDate?,                         // multiple formats can be provided separated by '|'
        @CsvGeneric(name = "offers Cola, Sprite or Fanta", converterName = "beverageBoolean")
        val refreshments: Boolean?                               // a user-defined converter can be used
    )
    
    // register a user-defined converter
    registerGenericConverter("beverageBoolean") {
        it.toLowerCase()=="indeed"
    }
    
    // some text in csv-format to be mapped
    val csvStream: InputStream = """
      city, addressLine1, Number of beds, latest check, RQIA, "offers Cola, Sprite or Fanta"
      if a line doesn't fit the pattern, it will be discarded <- like this line, the next line is fine because city and Number of beds are nullable
          , "2 Marylebone Rd",          ,2020/03/11,   WERS234, nope
      Berlin, "Berkaer Str 41", 1       ,28/08/2012, "NONE123", indeed
      Paris,"Rue Gauge, Maison 1", 4    ,          , "FR92834",
      Atlantis,,25000,,,
      """.trimIndent().byteInputStream()
    
    val dataRows: List<DataRow> = csv2List(            // <- this is how you trigger the mapping, you basically tell the lib when the InputStream comes from and which type the data is
      CsvSourceConfig(
        stream = csvStream 
      )    
    )
    👍 7
    j
    • 2
    • 2
  • m

    Madalin Valceleanu

    06/12/2020, 6:38 AM
    https://proandroiddev.com/android-components-architecture-in-a-modular-word-7414a0631969
    👍 2
    j
    • 2
    • 4
  • n

    Nick

    06/14/2020, 3:39 AM
    I just released Measured. A library that makes units a lot simpler and intuitive to work with. It uses the compiler to enforce correctness and lets you combine units into more complex ones using math operators. It is also extensible, making it easy to define your own units.
    val velocity     = 5 * meters / seconds
    val acceleration = 9 * meters / (seconds * seconds)
    val time         = 1 * minutes
    
    //  d = vt + ½at²
    val distance     = velocity * time + 1.0/2 * acceleration * time * time
    
    println(distance                ) // 16500 m
    println(distance `as` kilometers) // 16.5 km
    println(distance `as` miles     ) // 10.25262467191601 mi
    
    println(5 * miles / hours `as` meters / seconds) // 2.2352 m/s
    Try it out and provide feedback. (edited)
    👍 5
    🎖️ 2
    h
    a
    +2
    • 5
    • 5
Powered by Linen
Title
n

Nick

06/14/2020, 3:39 AM
I just released Measured. A library that makes units a lot simpler and intuitive to work with. It uses the compiler to enforce correctness and lets you combine units into more complex ones using math operators. It is also extensible, making it easy to define your own units.
val velocity     = 5 * meters / seconds
val acceleration = 9 * meters / (seconds * seconds)
val time         = 1 * minutes

//  d = vt + ½at²
val distance     = velocity * time + 1.0/2 * acceleration * time * time

println(distance                ) // 16500 m
println(distance `as` kilometers) // 16.5 km
println(distance `as` miles     ) // 10.25262467191601 mi

println(5 * miles / hours `as` meters / seconds) // 2.2352 m/s
Try it out and provide feedback. (edited)
👍 5
🎖️ 2
h

Hamza

06/14/2020, 3:39 AM
3rd time is the charm
😅 1
a

altavir

06/14/2020, 6:12 AM
Interesting. We had this feature on a backlog: https://github.com/mipt-npm/kmath/issues/75. But a separate library is also a good solution. Your current implementation has one flaw: it uses wrapper classes for
Measurement
meaning that you will have boxing performance overhead. My idea was to use inline clases with
Units
passed as a generic and resolved via reflections or comile-time resolution. It seems that that feature could be added without breaking existing code. We can discuss it in #science .
k

Kroppeb

06/14/2020, 7:43 AM
Wait why are you multiplying by
1000
before converting to kilometres and miles?
n

Nick

06/14/2020, 7:56 AM
Good catch. The docs had some old cruft. Fixed.
r

raulraja

06/15/2020, 12:54 PM
looks great
View count: 2