Kotlin programming cookbook explore more than 100 recipes that show how to build ro bust mobile and web applications with Kotlin, Spring Boot, and Android
Discover Android programming and web development by understanding the concepts of Kotlin Programming About This Book Practical solutions to your common programming problems with Kotlin 1.1 Leverage the functional power of Kotlin to ease your Android application development Learn to use Java code in...
Otros Autores: | , |
---|---|
Formato: | Libro electrónico |
Idioma: | Inglés |
Publicado: |
Birmingham, England :
Packt Publishing
2018.
|
Edición: | First edition |
Materias: | |
Ver en Biblioteca Universitat Ramon Llull: | https://discovery.url.edu/permalink/34CSUC_URL/1im36ta/alma991009631363906719 |
Tabla de Contenidos:
- Cover
- Title Page
- Copyright and Credits
- Packt Upsell
- Contributors
- Table of Contents
- Preface
- Chapter 1: Installation and Working with Environment
- Introduction
- Creating Kotlin Android project
- Getting ready
- How to do it...
- There's more...
- How to use Gradle to run Kotlin code
- Getting ready
- How to do it...
- There's more...
- See also
- How to run a Kotlin compiled class
- Getting ready
- How to do it...
- How it works...
- There's more...
- How to build a self-executable JAR with Gradle and Kotlin
- Getting ready
- How to do it...
- How it works...
- Reading console input in Kotlin
- Getting ready
- How to do it...
- How it works...
- Converting Java code to Kotlin and vice versa
- Getting ready
- How to do it...
- How it works...
- How to write an idiomatic logger in Kotlin
- Getting ready
- How to do it...
- How it works...
- There's more...
- See also
- Escaping for Java identifiers that are keywords in Kotlin
- Getting ready
- How to do it...
- How it works...
- Disambiguating using the "as" keyword to locally rename the clashing entity
- Getting ready
- How to do it...
- Doing bit manipulations in Kotlin
- Getting ready
- How to do it...
- Or
- and
- xor
- inv
- shl
- shr
- ushr
- How it works...
- Parsing String to Long, Double, or Int
- Getting ready
- How to do it...
- Converting String to Long
- Converting string to Long using string.toLongOrNull()
- Converting with special radix
- Parsing string to Long with special radix
- How it works...
- There's more...
- Using String templates in Kotlin
- How to do it...
- How it works...
- There's more...
- Chapter 2: Control Flow
- Introduction
- Assigning result to an expression using the if keyword
- Getting ready
- How to do it...
- There's more...
- Using range with the when expression.
- Getting ready
- How to do it...
- How it works...
- There's more...
- Using when with custom objects
- Getting ready
- How to do it...
- How it works...
- Using try-catch as an expression
- Getting ready
- How to do it...
- How it works...
- There's more...
- How to write a swap function in Kotlin using the also function
- Getting ready
- How to do it...
- How it works...
- There's more...
- How to throw a custom exception in Kotlin
- Getting ready
- How to do it...
- How it works...
- How to make a multiconditional loop in Kotlin
- Getting ready
- How to do it...
- How it works...
- Chapter 3: Classes and Objects
- Introduction
- Initializing body of constructor
- Getting ready
- How to do it...
- Converting one data type into another
- Getting ready
- How to do it...
- How it works...
- How to type check an object
- Getting ready
- How to do it...
- How it works...
- There's more...
- How to work with an abstract class in Kotlin
- Getting ready
- How to do it...
- How it works...
- How to iterate over a class's properties in Kotlin
- Getting ready
- How to do it...
- How it works...
- There's more...
- How to work with inline properties
- Getting ready
- How to do it...
- How it works...
- How to work with nested class
- Getting ready
- How to do it...
- How it works...
- There's more...
- Getting class in Kotlin
- How to do it...
- There's more...
- Working with delegated properties
- Getting ready
- How to do it...
- There's more...
- Working with enums
- Getting ready
- How to do it...
- There's more...
- Chapter 4: Functions
- Introduction
- Specifying default values in functions
- Getting ready
- How to do it...
- There's more...
- Using named arguments in functions
- Getting ready
- How to do it...
- Creating the RecyclerView Adapter in Kotlin
- Getting ready.
- How to do it...
- How it works...
- There's more...
- Creating getter setters in Kotlin
- Getting ready
- How to do it...
- There's more...
- Passing variable arguments to a function
- Getting ready
- How to do it...
- How it works...
- There's more...
- Passing a function as a parameter to another
- Getting ready
- How to do it...
- How it works...
- Declaring a static function
- Getting ready
- How to do it...
- Using the use keyword in Kotlin
- Getting ready
- How to do it...
- How it works...
- Working with closures
- Getting ready
- How to do it...
- There's more...
- Function literals with receivers
- Getting ready
- How to do it...
- Working with anonymous functions
- Getting ready
- How to do it...
- Chapter 5: Object-Oriented Programming
- Introduction
- Working with interfaces in Kotlin
- Getting ready
- How to do it…
- There's more…
- How to implement complicated interfaces with multiple overridden methods in Kotlin
- Getting ready
- How to do it…
- How to extend a class in Kotlin (Inheritance and Extension functions)
- Getting ready
- How to do it…
- Extension functions
- How it works…
- There's more…
- How to work with Generics in Kotlin
- Getting ready
- How to do it…
- There's more…
- How to implement polymorphism in Kotlin
- Getting ready
- How to do it…
- Restricting class hierarchies
- Getting ready
- How to do it…
- How it works…
- There's more…
- Chapter 6: Collections Framework
- Introduction
- How to merge two collections
- Getting ready
- How to do it…
- Splitting original collection into pair of collections
- Getting ready
- How to do it…
- How it works…
- There's more…
- Sorting a list by specified comparator
- Getting ready
- How to do it…
- How it works…
- Sorting in descending order
- Getting ready
- How to do it…
- How it works….
- Parsing a JSON response using Gson
- Getting ready
- How to do it…
- There's more…
- How to filter and map using lambda expressions
- Getting ready
- How to do it…
- How to sort a list of objects and keep null objects at the end
- Getting ready
- How to do it…
- How it works…
- How to implement a lazy list in Kotlin
- Getting ready
- How to do it…
- How it works…
- How to pad a string in Kotlin
- Getting ready
- How to do it…
- How it works…
- How to flatten an array or map
- Getting ready
- How to do it…
- How it works…
- How to sort collection by multiple fields in Kotlin
- Getting ready
- How to do it…
- How it works…
- How to use limit in Kotlin list
- Getting ready
- How to do it…
- How to create a 2D array in Kotlin
- Getting ready
- How to do it…
- There's more…
- How to skip the first "n" entries in Kotlin
- Getting ready
- How to do it…
- How it works…
- Chapter 7: Handling File Operations in Kotlin
- Introduction
- Reading from files using InputReader
- Getting ready
- How to do it…
- How it works…
- There's more…
- Reading all lines in a file using InputReader
- Getting ready
- How to do it…
- How it works…
- Reading line by line using InputReader
- Getting ready
- How to do it…
- How it works…
- Reading from files using BufferedReader
- Getting ready
- How to do it…
- How it works…
- Reading all lines in a file using BufferedReader
- Getting ready
- How to do it…
- How it works…
- Reading line by line using bufferedReader
- Getting ready
- How to do it…
- How it works…
- There's more…
- Reading string and JSON over network
- Getting ready
- How to do it…
- How it works…
- Chapter 8: Anko Commons and Extension Function
- Introduction
- Setting up Anko with Gradle
- Getting ready
- How to do it…
- Extending Android framework using extension function
- Getting ready.
- How to do it…
- How it works…
- There's more…
- Using extensions as properties
- Getting ready
- How to do it…
- How it works…
- There's more…
- Using intents with Anko
- Getting ready
- How to do it…
- How it works…
- Making a call intent using Anko
- Getting ready
- How to do it…
- How it works…
- Sending a text intent using Anko
- Getting ready
- How to do it…
- How it works…
- Browsing the web browser using Anko
- Getting ready
- How to do it…
- How it works…
- Sharing some text using intents in Anko
- Getting ready
- How to do it…
- How it works…
- Sending an email using Anko
- Getting ready
- How to do it…
- How it works…
- Creating Android dialogs with Anko
- Getting ready
- How to do it…
- Showing an alert dialog with a list of text items
- Getting ready
- How to do it…
- How it works…
- Using Anko in Views
- Getting ready
- How to do it…
- Logging using Anko
- Getting ready
- How to do it…
- Handling dimensions with Anko
- Getting ready
- How to do it…
- Version checking on Android
- Getting ready
- How to do it…
- How it works…
- Chapter 9: Anko Layouts
- Introduction
- Setting up Anko library for Anko layouts in Gradle
- Getting ready
- How to do it…
- How it works…
- There's more…
- Creating user-interface programmatically
- Getting ready
- How to do it…
- How it works…
- Working with the old code of XML layouts
- Getting ready
- How to do it…
- How it works…
- There's more…
- Using the provided AnkoComponent interface
- Getting ready
- How to do it…
- How it works…
- There's more…
- Setting theme for Android views in Anko
- Getting ready
- How to do it…
- Setting layout parameters for Anko views
- Getting ready
- How to do it…
- How it works…
- Adding listeners to Anko views
- Getting ready
- How to do it…
- How it works…
- There's more….
- Inserting XML layouts into DSL.