3 options
Kotlin standard library cookbook : master the powerful Kotlin standard library through practical code examples / Samuel Urbanowicz.
- Format:
- Book
- Author/Creator:
- Urbanowicz, Samuel, author.
- Language:
- English
- Subjects (All):
- Application software--Development.
- Application software.
- Physical Description:
- 1 online resource (242 pages)
- Edition:
- 1st edition
- Place of Publication:
- Birmingham ; Mumbai : Packt Publishing, 2018.
- System Details:
- text file
- Summary:
- Build optimized applications in Kotlin by learning how to smartly implement standard libraries. Key Features Get the most out of the Kotlin library to develop high-quality portable applications Explore the powerful support for data processing and I/O operations Discover ways to enhance your Android application development Book Description Given the verbosity of Java, developers have turned to Kotlin for effective software development. The Kotlin standard library provides vital tools that make day-to-day Kotlin programming easier. This library features the core attributes of the language, such as algorithmic problems, design patterns, data processing, and working with files and data streams. The recipes in this book offer coding solutions that can be readily executed. The book covers various topics related to data processing, I/O operations, and collections transformation. We'll walk through effective design patterns in Kotlin and you'll understand how coroutines add new features to JavaScript. As you make your way through the chapters, you'll learn how to implement clean, reusable functions and scalable interfaces containing default implementations. In the concluding chapters, we'll provide recipes on functional programming concepts, such as lambdas, monads, functors, and Kotlin scoping functions. By the end of the book, you'll be able to address a range of problems that Kotlin developers face by implementing easy-to-follow solutions. What you will learn Work with ranges, progressions, and sequences in use cases Add new functionalities to current classes with Kotlin extensions Understand elements such as lambdas, closures, and monads Build a REST API consumer with Retrofit and a coroutine adapter Discover useful tips and solutions for making your Android projects Explore the benefits of standard library features Who this book is for This book is for software developers who are familiar with Kotlin's basics and want to discover more advanced features and concepts, especially those provided by the Kotlin standard library. It's also ideal for experienced software developers who are familiar with the functional programming paradigm and other programming languages who want to switch to Kotlin. It will also help Java developers switch to Kotlin and integrate it into existing Java Virtual Machine (JVM) projects.
- Contents:
- Cover
- Title Page
- Copyright and Credits
- Dedication
- Packt Upsell
- Contributors
- Table of Contents
- Preface
- Chapter 1: Ranges, Progressions, and Sequences
- Introduction
- Exploring the use of range expressions to iterate through alphabet characters
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Traversing through ranges using progression with a custom step value
- Building custom progressions to traverse dates
- Using range expressions with flow control statements
- Discovering the concept of sequences
- Applying sequences to solve algorithmic problems
- Chapter 2: Expressive Functions and Adjustable Interfaces
- Declaring adjustable functions with default parameters
- Declaring interfaces containing default implementations
- Extending functionalities of classes
- Destructuring types
- Returning multiple data
- Inlining parameters of closure type
- Infix notations for functions
- See also.
- Smart types checking with generic reified parameters
- Overloading operators
- Chapter 3: Shaping Code with Kotlin Functional Programming Features
- Working effectively with lambda expressions
- Discovering basic scoping functions - let, also, apply
- Initializing objects the clean way using the run scoping function
- Working with higher-order functions
- Functions currying
- Function composition
- Implementing the Either Monad design pattern
- Approach to automatic functions memoization
- Chapter 4: Powerful Data Processing
- Composing and consuming collections the easy way
- Filtering datasets
- Automatic null removal
- Sorting data with custom comparators
- Getting started
- Building strings based on dataset elements
- Dividing data into subsets
- Data transformation with map and flatMap
- Folding and reducing data sets
- Grouping data
- Chapter 5: Tasteful Design Patterns Adopting Kotlin Concepts
- Implementing the Strategy pattern
- Exploring the power of the Delegation pattern
- Implementing delegated class properties
- Tracking state with the Observer pattern
- Restricting property updates with the Vetoable delegate
- Implementing the advanced Observer pattern by defining a custom property delegate
- Working with the Lazy delegate
- Implementing builders the smart way
- Chapter 6: Friendly I/O Operations
- Reading the contents of a file
- Ensuring stream closing with the use function
- Reading the contents of a file line by line
- Writing the contents to a file
- Appending a file
- Easy file copying
- Traversing files in a directory.
- Getting ready
- Chapter 7: Making Asynchronous Programming Great Again
- Executing tasks in the background using threads
- Background threads synchronization
- Using coroutines for asynchronous, concurrent execution of tasks
- Using coroutines for asynchronous, concurrent tasks execution with results handling
- Applying coroutines for asynchronous data processing
- Easy coroutine cancelation
- Building a REST API client with Retrofit and a coroutines adapter
- Wrapping third-party callback-style APIs with coroutines
- Chapter 8: Best Practices for the Android, JUnit, and JVM UI Frameworks
- Clean and safe view-binding with the Android Extensions plugin
- Applying coroutines for asynchronous UI programming on Android, JavaFX, and Swing
- Easy class serialization on Android using the @Parcelize annotation
- Implementing a custom property delegate that provides lifecycle-aware values
- Easy operations on SharedPreferences
- Getting ready.
- How to do it...
- Less boilerplate Cursor data parsing
- Mocking dependencies with the Mockito Kotlin library
- Verifying function invocations
- Unit tests for Kotlin coroutines
- Chapter 9: Miscellaneous
- Kotlin and Java interoperability
- Kotlin and JavaScript interoperability
- Renaming generated functions
- Decompiling Kotlin code to Java and JVM bytecode
- Adding custom names for imports
- Wrapping complex type declarations with type aliases
- Expressive try…catch declarations
- Safe type-casting
- Other Books You May Enjoy
- Index.
- Notes:
- Includes index.
- Description based on print version record.
- OCLC:
- 1050953360
The Penn Libraries is committed to describing library materials using current, accurate, and responsible language. If you discover outdated or inaccurate language, please fill out this feedback form to report it and suggest alternative language.