Book description
It takes a week to travel the 8,000 miles overland from Java to Kotlin. If you're an experienced Java developer who has tried the Kotlin language, you were probably productive in about the same time.
You'll have found that they do things differently in Kotlin, though. Nullability is important, collections are different, and classes are final by default. Kotlin is more functional, but what does that mean, and how should it change the way that you program? And what about all that Java code that you still have to support?
Your tour guides Duncan and Nat first made the trip in 2015, and they've since helped many teams and individuals follow in their footsteps. Travel with them as they break the route down into legs like Optional to Nullable, Beans to Values, and Open to Sealed Classes. Each explains a key concept and then shows how to refactor production Java to idiomatic Kotlin, gradually and safely, while maintaining interoperability.
The resulting code is simpler, more expressive, and easier to change. By the end of the journey, you'll be confident in refactoring Java to Kotlin, writing Kotlin from scratch, and managing a mixed language codebase as it evolves over time.
Publisher resources
Table of contents
- Preface
- 1. Introduction
- 2. Java to Kotlin Projects
- 3. Java to Kotlin Classes
- 4. Optional to Nullable
- 5. Beans to Values
- 6. Java to Kotlin Collections
- 7. Actions to Calculations
- 8. Static Methods to Top-Level Functions
- 9. Multi- to Single-Expression Functions
- 10. Functions to Extension Functions
- 11. Methods to Properties
- 12. Functions to Operators
- 13. Streams to Iterables to Sequences
- 14. Accumulating Objects to Transformations
- 15. Encapsulated Collections to Type Aliases
- 16. Interfaces to Functions
- 17. Mocks to Maps
- 18. Open to Sealed Classes
- 19. Throwing to Returning
- 20. Performing I/O to Passing Data
- 21. Exceptions to Values
- 22. Classes to Functions
- 23. Continuing the Journey
- Bibliography
- Index
Product information
- Title: Java to Kotlin
- Author(s):
- Release date: August 2021
- Publisher(s): O'Reilly Media, Inc.
- ISBN: 9781492082279
You might also like
video
Java to Kotlin
The Gilded Rose is a classic refactoring kata, available in many languages at https://github.com/emilybache/GildedRose-Refactoring-Kata. In this …
book
Kotlin in Action
Kotlin in Action guides experienced Java developers from the language basics of Kotlin all the way …
book
Head First Kotlin
What will you learn from this book? Head First Kotlin is a complete introduction to coding …
video
Introduction to Kotlin Programming
Kotlin 1.0 was released in February 2016, and since that time it’s been embraced by developers …