Kotlin Cookbook: A Problem-Focused Approach
Book information
Description
Foreword Preface Who Should Read This Book How This Book Is Organized Conventions Used in This Book Using Code Examples O’Reilly Online Learning How to Contact Us Acknowledgments 1. Installing and Running Kotlin 1.1. Running Kotlin Without a Local Compiler 1.2. Installing Kotlin Locally 1.3. Compiling and Running Kotlin from the Command Line 1.4. Using the Kotlin REPL 1.5. Executing a Kotlin Script 1.6. Building a Standalone Application Using GraalVM 1.7. Adding the Kotlin Plug-in for Gradle (Groovy Syntax) 1.8. Adding the Kotlin Plug-in for Gradle (Kotlin Syntax) 1.9. Using Gradle to Build Kotlin Projects 1.10. Using Maven with Kotlin 2. Basic Kotlin 2.1. Using Nullable Types in Kotlin 2.2. Adding Nullability Indicators to Java 2.3. Adding Overloaded Methods for Java 2.4. Converting Between Types Explicitly 2.5. Printing to Different Bases 2.6. Raising a Number to a Power 2.7. Using Bitwise Shift Operators 2.8. Using Bitwise Boolean Operators 2.9. Creating Pair Instances with to 3. Object-Oriented Programming in Kotlin 3.1. Understanding the Difference Between const and val 3.2. Creating Custom Getters and Setters 3.3. Defining Data Classes 3.4. The Backing Property Technique 3.5. Overloading Operators 3.6. Using lateinit for Delayed Initialization 3.7. Using Safe Casting, Reference Equality, and Elvis to Override equals 3.8. Creating a Singleton 3.9. Much Ado About Nothing 4. Functional Programming 4.1. Using fold in Algorithms 4.2. Using the reduce Function for Reductions 4.3. Applying Tail Recursion 5. Collections 5.1. Working with Arrays 5.2. Creating Collections 5.3. Creating Read-Only Views from Existing Collections 5.4. Building a Map from a Collection 5.5. Returning a Default When a Collection Is Empty 5.6. Restricting a Value to a Given Range 5.7. Processing a Window on a Collection 5.8. Destructuring Lists 5.9. Sorting by Multiple Properties 5.10. Defining Your Own Iterator 5.11. Filtering a Collection by Type 5.12. Making a Range into a Progression 6. Sequences 6.1. Using Lazy Sequences 6.2. Generating Sequences 6.3. Managing Infinite Sequences 6.4. Yielding from a Sequence 7. Scope Functions 7.1. Initializing Objects After Construction with apply 7.2. Using also for Side Effects 7.3. Using the let Function and Elvis 7.4. Using let with a Temporary Variable 8. Kotlin Delegates 8.1. Implementing Composition by Delegation 8.2. Using the lazy Delegate 8.3. Ensuring That a Value Is Not Null 8.4. Using the observable and vetoable Delegates 8.5. Supplying Maps as Delegates 8.6. Creating Your Own Delegates 9. Testing 9.1. Setting the Test Class Life Cycle 9.2. Using Data Classes for Tests 9.3. Using Helper Functions with Default Arguments 9.4. Repeating JUnit 5 Tests with Different Data 9.5. Using Data Classes for Parameterized Tests 10. Input/Output 10.1. Managing Resources with use 10.2. Writing to a File 11. Miscellaneous 11.1. Working with the Kotlin Version 11.2. Executing a Lambda Repeatedly 11.3. Forcing when to Be Exhaustive 11.4. Using the replace Function with Regular Expressions 11.5. Converting to Binary String and Back 11.6. Making a Class Executable 11.7. Measuring Elapsed Time 11.8. Starting Threads 11.9. Forcing Completion with TODO 11.10. Understanding the Random Behavior of Random 11.11. Using Special Characters in Function Names 11.12. Telling Java About Exceptions 12. The Spring Framework 12.1. Opening Spring-Managed Bean Classes for Extension 12.2. Persisting Kotlin Data Classes 12.3. Injecting Dependencies 13. Coroutines and Structured Concurrency 13.1. Choosing Coroutine Builders 13.2. Replacing async/await with withContext 13.3. Working with Dispatchers 13.4. Running Coroutines on a Java Thread Pool 13.5. Cancelling Coroutines 13.6. Debugging Coroutines Index
Similar books
Программирование на Kotlin для Android
2024 · PDF
Kotlin® Notes for Professionals book
2018 · PDF
Beginner's Guide to Kotlin Programming
2021 · EPUB
Beginner's Guide to Kotlin Programming
2021 · PDF
Java to Kotlin: A Refactoring Guidebook
2021 · EPUB
Kotlin and Android Development featuring Jetpack: Build Better, Safer Android Apps
2021 · EPUB
Kotlin and Android Development featuring Jetpack: Build Better, Safer Android Apps
2021 · EPUB
Android Apprentice
EPUB