Chapter 1, Ranges, Progressions, and Sequences, presents the concept of Kotlin ranges and sequences. It shows how to approach common algorithmic problems by defining custom sequences and how to define ranges for custom classes.
Chapter 2, Expressive Functions and Adjustable Interfaces, shows how to approach designing functions and interfaces using the language's built-in features. The chapter explains how to implement clean, reusable functions, and scalable interfaces containing default implementations. The recipes also cover other features of the language, such as inlining closures, destructuring variables, reified type parameters, and other useful tips that help design more flexible and natural code.
Chapter 3, Shaping Code with Kotlin Functional Programming Features, shows how to solve real-life programming challenges by adopting state-of-the-art functional programming patterns. The chapter helps readers get familiar with Kotlin support for functional programming concepts provided by the standard library and the built-in language features.
Chapter 4, Powerful Data Processing, focuses on presenting standard library support for declarative style operations on collections. The included recipes present solutions to varying programming problems related to dataset transformations, reducing, or filtering. The chapter shows how to approach data processing operations practicing a functional programming style with the use of powerful functionalities built into the standard library.
Chapter 5, Tasteful Design Patterns Adopting Kotlin Concepts, presents the Kotlin-specific approach to implementing popular design patterns, including the Observer and Lazy delegates, Builder, Strategy, and more. Design patterns presented in the following chapter are backed by real-life examples that emphasize the benefits of the Delegation pattern.
Chapter 6, Friendly I/O Operations, presents useful extension functions available in the standard library that simplify the work with I/O operations. The chapter focuses on common use cases of read-write operations on files, working with streams and buffers, and the Kotlin approach to traversing files available in a specific directory.
Chapter 7, Making Asynchronous Programming Great Again, is an in-depth guide to asynchronous programming focusing on the Kotlin coroutines framework and its application in real-life situations. The chapter presents how to optimize and advance previous examples by executing parts of their code in the background in a non-blocking way. Here, you will also find a practical example of implementing an asynchronous REST client with the Retrofit library and the coroutines framework.
Chapter 8, Best Practices for the Android, JUnit, and JVM UI Frameworks, covers practical problems specific to the popular frameworks, among which Kotlin is the one used most often. In general, it will focus on Android platform-specific aspects and asynchronous UI programming with coroutines, both on Android and JVM frameworks such as JavaFX and Swing. It will also help you to write effective unit tests for the JVM platform using the JUnit framework. The recipes related to unit testing will also include more advanced topics, such as mocking dependencies with the Mockito Kotlin library and testing asynchronous code based on the coroutines framework.
Chapter 9, Miscellaneous, presents handy solutions to various problems and issues that Kotlin developers deal with on a daily basis.