Practical solutions

Kotlin Howtos How-To Guides

Solve the problem. Keep building. Collection of Kotlin how-to articles

Find the answer you need

Browse practical solutions, grouped by the task you're working on.

__COUNT__ entries on this page

How to Create an HTTP Request in KotlinThis tutorial teaches the reader the different ways they can use to create an HTTP request in Kotlin. How to Create a Singleton in KotlinThis tutorial teaches the reader the different ways they can use to create a singleton in Kotlin. How to Use the with Keyword in KotlinThis tutorial teaches the reader how to use the with keyword in Kotlin. How to Sort a Collection Using Multiple Fields in KotlinThis tutorial teaches the reader the different approaches they can use to sort a collection using multiple fields in Kotlin. How to Clone Object in KotlinThis tutorial teaches the reader the different ways they can use to clone an object in Kotlin. How to Use synchronized() and withLock() to Lock Shared Resources in KotlinThis tutorial teaches the reader how to control access to shared resources by using the synchronized() and withLock() functions. How to Split a String Into an Array in KotlinThis tutorial teaches the reader the different ways that they can use to split a string into an array in Kotlin. How to Implement the Floor Modulo Function in KotlinThis tutorial teaches the reader how to implement the floor modulo function for all numeric types in Kotlin. How to Use of Stack Data Structure in KotlinThis article teaches you how to use the stack data structure in Kotlin. It also lists some methods you can use with stack and an alternative. How to Create Lists in KotlinList is a type of collection in Kotlin that allows storing elements that we can access and modify. This article teaches how to create and use a list in Kotlin. How to Convert String to Int in KotlinYou can convert a Kotlin string to integer if you are building a program or application that accepts multiple parameters, and you want to ensure you only pass integer parameters. How to Check Kotlin Variable TypeKnowing the type of variable in Kotlin can help reduce conversion errors and offer many such benefits. Learn everything about how to check the type of variable in Kotlin. Ternary Conditional Operator in KotlinThis article teaches alternatives for Ternary Operators like if-else expression, if-else-if ladder, when expression, and Elvis operator using Kotlin. The Ultimate Guide to Initializing Lists in KotlinKotlin lists allow collecting and storing items that are accessible and modifiable. This guide lists a few ways to initialize lists in Kotlin. Higher Order Functions in KotlinThis tutorial teaches how to pass a function as a parameter and how to return a function using a function in Kotlin. Kotlin Private ConstructorJava allows hiding a constructor by making it private. This article discusses how to achieve the same private constructor in Kotlin. Kotlin runBlocking: Bridging the Non-Coroutine World With Coroutine CodeThe Kotlin runBlocking function allows blocking an entire thread. We will see more about Kotlin Coroutine runBlocking in this article. Kotlin Spread OperatorThis tutorial teaches the reader how the spread operator works and where it is used in Kotlin. Object vs Class in KotlinThis tutorial teaches the reader the concepts behind classes and objects and how to use them in our applications. Kotlin flatMap() FunctionThis tutorial teaches the reader how the flatMap function works, the difference between flatMap and Map functions in Kotlin. Difference Between Kotlin Init and ConstructorsConstructors and Kotlin init blocks are a vital part of this programing language. This article offers an overview of the difference between init and constructors. Difference Between fold() and reduce() in KotlinThis tutorial teaches the reader how to differentiate between the fold() and reduce() methods in Kotlin. Equivalent of Java String[] in KotlinThis article introduces the equivalent of Java String[] in Kotlin. We will see all the possible ways to achieve the same results for Kotlin as achieved by String[] in Java. Difference Between Open and Public Keywords in KotlinThis article will introduce the use of Kotlin open and public keywords. We will also learn about the open keyword in details with suitable examples.