Java → Kotlin/JVM
Think in Kotlin.
You already know Java. Learn where Kotlin changes the decision, then write the code yourself.
Index users by ID
Java 25
users.stream().collect(toMap(
User::id, identity(),
(prior, latest) -> latest
))Kotlin
users.associateBy { it.id }Duplicate ID? Both keep the last profile.
Curriculum
Learning path
26 chapters · 78 questions
Everyday Kotlin
Make everyday Java decisions in Kotlin.
- 01Choose val or varTrack a warehouse balance without losing intermediate stock levels.
- 02Price a delivery with whenPut overlapping delivery rules in the order the business promises.
- 03Compare parcel identitiesSeparate value equality, reference identity, and missing identifiers.
- 04Narrow a scanner payloadUse a guard to make a nullable, unknown value safe to inspect.
- 05Resolve a display nameCombine safe calls and Elvis without loading an unnecessary fallback.
- 06Give a retry policy defaultsExpress a dependent default once and let callers override just the decision they own.
- 07Format a transit ETAPlace identifiers, expressions, and literal suffixes in a string template.
Working with data
Choose collection operations that preserve your contract.
- 01Index users by IDChoose what survives when two directory updates have the same key.
- 02Freeze the dispatch queueDistinguish a read-only reference from a snapshot of a mutable collection.
- 03Revise a release ticketCopy a value with one changed field and keep the original ticket usable.
- 04Import valid quantitiesUse a nullable transformation when an invalid row may disappear.
- 05Select exactly one routeDistinguish a first match from a unique match before choosing a terminal operation.
- 06Count orders by depotDecide whether each group needs its members or just a count.
- 07Stop searching once seats fillUse a lazy pipeline when the number of predicate calls is observable.
- 08Put a badge on a contactUse an extension for display formatting while making subtype decisions explicit.
Designing Kotlin APIs
Make your types communicate how an API should be used.
- 01Choose a scope functionChoose which job a caller receives when saving a configured draft produces a normalized copy.
- 02Render every response stateMake adding a network outcome a compiler-visible UI change.
- 03Pass a companion as a factoryLet a type own validation and supply a parser wherever a decoder is required.
- 04Decorate a price bookChoose which operations to forward when a wrapper changes the price of an item.
- 05Connect producers and consumersLet a feed of express parcels write to an archive that accepts any object.
- 06Return a booking refusalSeparate a recoverable customer choice from a broken inventory precondition.
Kotlin on the JVM
Work across language boundaries and concurrent lifetimes.
- 01Read a Java platform typeGive a legacy setting three meanings: absent, disabled, or configured.
- 02Keep Java call sites compilingExpose Kotlin defaults through the JVM methods that Java clients actually call.
- 03Cancel an obsolete searchKeep transport recovery from publishing stale results after cancellation.
- 04Give concurrent work an ownerStart two independent lookups together and end both with the departure-board request.
- 05Collect a cold Flow on demandRead enough sensor samples to fill an alert panel and release the upstream producer.