← all projects

learn this topic (theory + diagrams) →

from-java-to-kotlin

Your interactive cheat sheet for the Java → Kotlin transition — every concept, side by side, with the 'why' noted.

View on GitHub ↗Javaupdated 2d ago

KotlinJavaDocs

High-level design

A Java → Kotlin reference organised as a cheat sheet — each row shows the Java way next to the idiomatic Kotlin way, so the migration is a lookup, not a memorisation exercise.

Basics

printing, variables, null-safety

Strings

templates, multiline, substring

Control flow

when, ranges, for-loops, smart casts

Collections

listOf, filter, sorting, destructuring

Classes & objects

data class, object, companion, lateinit

Advanced

generics, extension functions

Low-level design

The thesis: Kotlin didn't add features so much as make Java's boilerplate patterns first-class.

  • A ~30-line POJO becomes a one-line data class — the single biggest productivity win
  • Null-safety is the headline: non-null by default, opt in with ?, so whole classes of NPEs become impossible to write
  • switch → when (an expression), instanceof + cast → is + smart cast, static utils → extension functions