#KotlinTips

Wilhelm Fitzpatrickrafial@hackers.town
2024-12-09

Impressed by how developers at #dayjob were able to elegantly leverage the Kotlin type system to create even more opportunities for NPEs:

fun info(tag: String?, msg: String?) {
logInfo(tag!!, msg!!)
}

#KotlinTips

Code with the Italians 🀌codewiththeitalians@androiddev.social
2024-09-25

πŸ‘¨β€πŸ’» Elevate your Kotlin skills with Romain Guy from Google! Join our live discussion on performance and optimizations: cwti.link/twitch #KotlinTips #EfficientCoding

2021-07-26
β™² @kotlin@twitter.com:
#KotlinTips

The β€˜when’ expression is exhaustive if used in combination with sealed classes or enums. The compiler will complain if you forget to handle any of the cases, thus alerting you to possible mistakes.
Guillaume Loursglours@framapiaf.org
2020-12-30

RT @kotlin@twitter.com

Use the partition function to split a collection into two lists based on a predicate. The function returns a pair of lists:
the first contains all elements for which the predicate evaluates to true;
the second contains all the other elements. kotlinlang.org/api/latest/jvm/
#KotlinTips

πŸ¦πŸ”—: twitter.com/kotlin/status/1344

2020-12-17
In Kotlin/JS windows.fetch.json() on array responses returns JS Arrays so cast to Array<T> *NOT* List<T>. If you need to return a List<T> create it from the fetch results (Array doesn't have .toList though). #KotlinTips #kotlin

Client Info

Server: https://mastodon.social
Version: 2025.04
Repository: https://github.com/cyevgeniy/lmst