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
Programming Android with Kotlin
Developing applications for the Android mobile operating system can seem daunting, particularly if it requires learning …
video
Advanced Kotlin Programming
Designed for developers who already have a basic understanding of Kotlin, this video course examines some …
book
Functional Programming in Kotlin
Master techniques and concepts of functional programming to deliver safer, simpler, and more effective Kotlin code. …