Kotlin Standard Library Cookbook

Master the powerful Kotlin standard library through practical code examples
 
 
Packt Publishing
  • 1. Auflage
  • |
  • erschienen am 30. Juli 2018
  • |
  • 242 Seiten
 
E-Book | PDF mit Adobe DRM | Systemvoraussetzungen
978-1-78883-464-3 (ISBN)
 
Build optimized applications in Kotlin by learning how to make use of the standard library features the smart wayKey FeaturesGet the most out of the Kotlin library to develop high-quality portable applicationsExplore the powerful support for data processing and I/O operationsDiscover ways to enhance your Android application developmentBook DescriptionGiven 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 learnWork with ranges, progressions, and sequences in use casesAdd new functionalities to current classes with Kotlin extensionsUnderstand elements such as lambdas, closures, and monadsBuild a REST API consumer with Retrofit and a coroutine adapterDiscover useful tips and solutions for making your Android projectsExplore the benefits of standard library featuresWho this book is forThis 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.
  • Englisch
  • Birmingham
  • |
  • Großbritannien
  • Für Beruf und Forschung
978-1-78883-464-3 (9781788834643)
weitere Ausgaben werden ermittelt
Samuel Urbanowicz is an experienced software engineer skilled in mobile applications and backend development. A fan of modern programming languages, he has been using Kotlin since its beginning. He's always curious to dive into technologies. He is especially passionate about machine learning. Samuel believes that the Kotlin language has great potential for multiplatform development. He has work experience in both big corps and small start-ups. He is an active contributor to open source projects.
  • 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
  • Getting ready
  • How to do it...
  • How it works...
  • See also
  • Building custom progressions to traverse dates
  • Getting ready
  • How to do it...
  • How it works...
  • Using range expressions with flow control statements
  • Getting ready
  • How to do it...
  • How it works...
  • There's more...
  • See also
  • Discovering the concept of sequences
  • Getting ready
  • How to do it...
  • How it works...
  • There's more...
  • See also
  • Applying sequences to solve algorithmic problems
  • Getting ready
  • How to do it...
  • How it works...
  • Chapter 2: Expressive Functions and Adjustable Interfaces
  • Introduction
  • Declaring adjustable functions with default parameters
  • How to do it...
  • How it works...
  • See also
  • Declaring interfaces containing default implementations
  • Getting ready
  • How to do it...
  • How it works...
  • There's more...
  • See also
  • Extending functionalities of classes
  • Getting ready
  • How to do it...
  • How it works...
  • There's more...
  • Destructuring types
  • Getting ready
  • How to do it...
  • How it works...
  • There's more...
  • Returning multiple data
  • How to do it...
  • How it works...
  • There's more...
  • See also
  • Inlining parameters of closure type
  • Getting ready
  • How to do it...
  • How it works...
  • There's more...
  • Infix notations for functions
  • Getting ready
  • How to do it...
  • How it works...
  • There's more...
  • See also
  • Smart types checking with generic reified parameters
  • Getting ready
  • How to do it...
  • How it works...
  • Overloading operators
  • Getting ready
  • How to do it...
  • How it works...
  • There's more...
  • Chapter 3: Shaping Code with Kotlin Functional Programming Features
  • Introduction
  • Working effectively with lambda expressions
  • Getting ready
  • How to do it...
  • How it works...
  • There's more...
  • Discovering basic scoping functions - let, also, apply
  • Getting ready
  • How to do it...
  • How it works...
  • See also
  • Initializing objects the clean way using the run scoping function
  • Getting ready
  • How to do it...
  • How it works...
  • There's more...
  • See also
  • Working with higher-order functions
  • How to do it...
  • How it works...
  • Functions currying
  • Getting ready
  • How to do it...
  • How it works...
  • There's more...
  • Function composition
  • Getting ready
  • How to do it...
  • How it works...
  • Implementing the Either Monad design pattern
  • How to do it...
  • How it works...
  • There's more...
  • Approach to automatic functions memoization
  • How to do it...
  • How it works...
  • There's more...
  • Chapter 4: Powerful Data Processing
  • Introduction
  • Composing and consuming collections the easy way
  • Getting ready
  • How to do it...
  • How it works...
  • There's more...
  • See also
  • Filtering datasets
  • Getting ready
  • How to do it...
  • How it works...
  • There's more...
  • See also
  • Automatic null removal
  • How to do it...
  • How it works...
  • See also
  • Sorting data with custom comparators
  • Getting started
  • How to do it...
  • How it works...
  • There's more...
  • Building strings based on dataset elements
  • How to do it...
  • How it works...
  • There's more...
  • See also
  • Dividing data into subsets
  • Getting ready
  • How to do it...
  • How it works...
  • There's more...
  • See also
  • Data transformation with map and flatMap
  • How to do it...
  • How it works...
  • There's more...
  • Folding and reducing data sets
  • How to do it...
  • How it works...
  • There's more...
  • Grouping data
  • How to do it...
  • How it works...
  • There's more...
  • See also
  • Chapter 5: Tasteful Design Patterns Adopting Kotlin Concepts
  • Introduction
  • Implementing the Strategy pattern
  • How to do it...
  • How it works...
  • There's more...
  • See also
  • Exploring the power of the Delegation pattern
  • Getting ready
  • How to do it...
  • How it works...
  • See also
  • Implementing delegated class properties
  • Getting ready
  • How to do it...
  • How it works...
  • There's more...
  • See also
  • Tracking state with the Observer pattern
  • How to do it...
  • How it works...
  • See also
  • Restricting property updates with the Vetoable delegate
  • How to do it...
  • How it works...
  • See also
  • Implementing the advanced Observer pattern by defining a custom property delegate
  • How to do it...
  • How it works...
  • See also
  • Working with the Lazy delegate
  • How to do it...
  • How it works...
  • See also
  • Implementing builders the smart way
  • Getting ready
  • How to do it...
  • How it works...
  • There's more...
  • See also
  • Chapter 6: Friendly I/O Operations
  • Introduction
  • Reading the contents of a file
  • Getting ready
  • How to do it...
  • How it works...
  • See also
  • Ensuring stream closing with the use function
  • Getting ready
  • How to do it...
  • How it works...
  • Reading the contents of a file line by line
  • Getting ready
  • How to do it...
  • How it works...
  • See also
  • Writing the contents to a file
  • How to do it...
  • How it works...
  • See also
  • Appending a file
  • How to do it...
  • How it works...
  • Easy file copying
  • Getting ready
  • How to do it...
  • How it works...
  • Traversing files in a directory
  • Getting ready
  • How to do it...
  • How it works...
  • Chapter 7: Making Asynchronous Programming Great Again
  • Introduction
  • Executing tasks in the background using threads
  • Getting ready
  • How to do it...
  • How it works...
  • See also
  • Background threads synchronization
  • Getting ready
  • How to do it...
  • How it works...
  • See also
  • Using coroutines for asynchronous, concurrent execution of tasks
  • Getting ready
  • How to do it...
  • How it works...
  • See also
  • Using coroutines for asynchronous, concurrent tasks execution with results handling
  • Getting ready
  • How to do it...
  • How it works...
  • There's more...
  • See also
  • Applying coroutines for asynchronous data processing
  • How to do it...
  • How it works...
  • See also
  • Easy coroutine cancelation
  • Getting ready
  • How to do it...
  • How it works...
  • See also
  • Building a REST API client with Retrofit and a coroutines adapter
  • Getting ready
  • How to do it...
  • How it works...
  • See also
  • Wrapping third-party callback-style APIs with coroutines
  • Getting ready
  • How to do it...
  • How it works...
  • See also
  • Chapter 8: Best Practices for the Android, JUnit, and JVM UI Frameworks
  • Introduction
  • Clean and safe view-binding with the Android Extensions plugin
  • Getting ready
  • How to do it...
  • How it works...
  • There's more...
  • Applying coroutines for asynchronous UI programming on Android, JavaFX, and Swing
  • Getting ready
  • How to do it...
  • How it works...
  • There's more...
  • See also
  • Easy class serialization on Android using the @Parcelize annotation
  • Getting ready
  • How to do it...
  • How it works...
  • See also
  • Implementing a custom property delegate that provides lifecycle-aware values
  • Getting ready
  • How to do it...
  • How it works...
  • See also
  • Easy operations on SharedPreferences
  • Getting ready
  • How to do it...
  • How it works...
  • See also
  • Less boilerplate Cursor data parsing
  • Getting ready
  • How to do it...
  • How it works...
  • Mocking dependencies with the Mockito Kotlin library
  • Getting ready
  • How to do it...
  • How it works...
  • See also
  • Verifying function invocations
  • Getting ready
  • How to do it...
  • How it works...
  • Unit tests for Kotlin coroutines
  • Getting ready
  • How to do it...
  • How it works...
  • Chapter 9: Miscellaneous
  • Introduction
  • Kotlin and Java interoperability
  • How to do it...
  • How it works...
  • Kotlin and JavaScript interoperability
  • Getting ready
  • How to do it...
  • How it works...
  • There's more...
  • Renaming generated functions
  • How to do it...
  • How it works...
  • There's more...
  • See also
  • Decompiling Kotlin code to Java and JVM bytecode
  • Getting ready
  • How to do it...
  • How it works...
  • Adding custom names for imports
  • How to do it...
  • How it works...
  • Wrapping complex type declarations with type aliases
  • Getting ready
  • How to do it...
  • How it works...
  • Expressive try.catch declarations
  • Getting ready
  • How to do it...
  • How it works...
  • There's more...
  • Safe type-casting
  • How to do it...
  • How it works...
  • Other Books You May Enjoy
  • Index

Dateiformat: PDF
Kopierschutz: Adobe-DRM (Digital Rights Management)

Systemvoraussetzungen:

Computer (Windows; MacOS X; Linux): Installieren Sie bereits vor dem Download die kostenlose Software Adobe Digital Editions (siehe E-Book Hilfe).

Tablet/Smartphone (Android; iOS): Installieren Sie bereits vor dem Download die kostenlose App Adobe Digital Editions (siehe E-Book Hilfe).

E-Book-Reader: Bookeen, Kobo, Pocketbook, Sony, Tolino u.v.a.m. (nicht Kindle)

Das Dateiformat PDF zeigt auf jeder Hardware eine Buchseite stets identisch an. Daher ist eine PDF auch für ein komplexes Layout geeignet, wie es bei Lehr- und Fachbüchern verwendet wird (Bilder, Tabellen, Spalten, Fußnoten). Bei kleinen Displays von E-Readern oder Smartphones sind PDF leider eher nervig, weil zu viel Scrollen notwendig ist. Mit Adobe-DRM wird hier ein "harter" Kopierschutz verwendet. Wenn die notwendigen Voraussetzungen nicht vorliegen, können Sie das E-Book leider nicht öffnen. Daher müssen Sie bereits vor dem Download Ihre Lese-Hardware vorbereiten.

Bitte beachten Sie bei der Verwendung der Lese-Software Adobe Digital Editions: wir empfehlen Ihnen unbedingt nach Installation der Lese-Software diese mit Ihrer persönlichen Adobe-ID zu autorisieren!

Weitere Informationen finden Sie in unserer E-Book Hilfe.


Download (sofort verfügbar)

44,59 €
inkl. 19% MwSt.
Download / Einzel-Lizenz
PDF mit Adobe DRM
siehe Systemvoraussetzungen
E-Book bestellen