World Congress 2022 Jun 15, 2022

Java Sealed Classes vs. Kotlin Sealed Classes #Slideless

Lothar Schulz

Tired of unpredictable, null-prone code? Discover how sealed classes in both Java 17 and Kotlin eliminate nullable return types through strict hierarchies and exhaustive pattern matching.

Pause
Mute Enter Fullscreen
#1 about 2 min

Controlling class extension with Java sealed classes

Java 17 introduces sealed classes to restrict and explicitly define permitted subtypes.

#2 about 2 min

Kotlin sealed classes as flexible super enums

Kotlin sealed classes enable fixed type hierarchies that store state in subclasses.

#3 about 7 min

Refactoring API integration using Kotlin sealed classes

Replacing nullable API responses with explicit success and failure data classes.

#4 about 6 min

Applying exhaustive pattern matching in Kotlin

The when expression ensures safe handling of all possible sealed class types.

#5 about 9 min

Structuring API responses with Java sealed classes

Creating explicit success and exception subclasses improves type safety in Java API integrations.

#6 about 3 min

Evaluating object subtypes with Java instanceof

Using traditional type checking allows branching logic based on the API response type.

#7 about 4 min

Reducing boilerplate with Java sealed interfaces and records

Transitioning from standard classes to records simplifies syntax and eliminates redundant code.

#8 about 4 min

Pattern matching with Java switch preview features

Java 17 enables exhaustive type matching to handle sealed class branches safely.

#9 about 3 min

Comparing Java and Kotlin sealed class features

Both languages offer parity in sealed class capabilities and robust type matching.

Matching moments

3:03 min

Introduction to Kotlin history and Java ecosystem interoperability

Urs Peter · World Congress 2022

3:01 min

Introduction to Kotlin and Java interoperability

Christian Woerz · LIVE

4:52 min

Introduction to the Java and Kotlin ecosystems

Iris Hunkeler · LIVE

1:33 min

Configuring runtime Java and Kotlin interoperability protocols

Iris Hunkeler · LIVE

1:43 min

Summarizing the practical engineering advantages of writing Kotlin

Iris Hunkeler · LIVE

3:16 min

Significant performance and language features launching in Java 21

Jonathan Vila · LIVE

Upcoming sessions on this topic

Open session

World Congress 2026 North America

September 25, 2026 · 14:50–15:20

Stage 6

Look What Java Can Do Now: Live-Coding a GenAI MCP Server with the JAQ Stack

Suren Konathala

Senior Engineering Leader, Marketing & AdTech, AI GTM & Digital Experience Platforms, Java x AI

Suren Konathala
Open session

World Congress 2026 North America

September 24, 2026 · 11:40–12:10

Stage 7

Clean Rooms Demystified: Architecture and Patterns for Privacy-Safe Data Collaboration

Anurag Malik

Data Tech Lead @ Intuit

Anurag Malik
Open session

World Congress 2026 North America

September 24, 2026 · 15:30–16:00

Stage 6

Going beyond the code through the GitHub Copilot App: how to unlock you and your team’s superpower

Jenny Hwang

Director of User Research at GitHub

Jenny Hwang
Open session

World Congress 2026 North America

September 24, 2026 · 16:10–16:40

Outdoor Stage

When Humans Stop Writing Code: Rethinking Languages, Compilers, and Responsibility

Simon Auer

Organizer of flutter vienna meetup and CEO of marqably

Simon Auer
Open session

World Congress 2026 North America

September 23, 2026 · 15:40–16:10

Stage 2

Lean Intelligence: Lessons from GitHub Copilot Data Science Efforts

Rahul Pandita

Researcher and Technical Advisor at Microsoft

Rahul Pandita
Open session

World Congress 2026 North America

September 24, 2026 · 14:10–14:40

Stage 9

One Repo, One Strategy: Scalable Full-Stack Testing in a Monorepo World

Bartosz Leczycki, Paweł Matynia

Bartosz Leczycki
Paweł Matynia