Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Kotlin Standard Library Cookbook

You're reading from   Kotlin Standard Library Cookbook Master the powerful Kotlin standard library through practical code examples

Arrow left icon
Product type Paperback
Published in Jul 2018
Publisher Packt
ISBN-13 9781788837668
Length 242 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Samuel Urbanowicz Samuel Urbanowicz
Author Profile Icon Samuel Urbanowicz
Samuel Urbanowicz
Arrow right icon
View More author details
Toc

Table of Contents (11) Chapters Close

Preface 1. Ranges, Progressions, and Sequences 2. Expressive Functions and Adjustable Interfaces FREE CHAPTER 3. Shaping Code with Kotlin Functional Programming Features 4. Powerful Data Processing 5. Tasteful Design Patterns Adopting Kotlin Concepts 6. Friendly I/O Operations 7. Making Asynchronous Programming Great Again 8. Best Practices for the Android, JUnit, and JVM UI Frameworks 9. Miscellaneous 10. Other Books You May Enjoy

What this book covers

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.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime