u/daioin r/Kotlin • Recommends
On “How not to code Kotlin like a Java dev?”
Things that Java devs usually do not use or try to avoid in Kotlin:
- smart casts https://kotlinlang.org/docs/typecasts.html#smart-casts
- functional style stuff(scope functions, higher order functions, composable functions, etc), here's a good video on it [video
- composition over inheritance(especially powered by interface delegates)
Things that Java devs usually do in Kotlin, but shouldn't:
- iterate over stuff using indices
- manually implement try-with-resources pattern rather than something like \`use\` scope function
- construct collections, streams and other similar classes when there's a factory function available(like \`listOf\` or \`File.outputStream()\`)
- use mutabl…