Kotlin

Kotlin : Lambdas and Higher-Order Functions

Reading Time: 3 minutes High order function (Higher level function) is a function which accepts function as a parameter, returns a function and it can do both. We can pass a function instead of passing Int, String, or other data types as a parameter in a function. Lambdas Expressions Lambdas Expressions are essentially anonymous functions that we can treat as values , for example -pass lambda expressions as arguments to Continue Reading

Getting Started with Kotlin

Reading Time: 2 minutes Introduction: In this blog, I am going to discuss the basics of the kotlin programming language. Kotlin is a statically, typically programmed programming language developed by JetBrains. It produces world-class IDEs like IntelliJ IDEA, PhpStorm, Appcode, etc. However, It was first introduced by JetBrains in 2011 with the new JVM language. It is an object-oriented language and a “better language” than Java. This language is Continue Reading

String Templates and Multiline Strings in Kotlin

Reading Time: 3 minutes String Templates In programs, we often create strings with embedded values of expressions. Concatenating values to create strings using the + operator makes the code verbose and hard to maintain. String templates solve that problem by providing an elegant solution. Within a double-quoted string, the $ symbol can prefix any variable to turn that into an expression. If the expression is more complex than a Continue Reading

How to create a Singleton class in Kotlin

Reading Time: 3 minutes What is Singleton Class? First of all, let us discuss what is singleton class is. We can define a singleton class in such a way that only one instance of the class can create and we can use that instance everywhere. We can use a singleton class where we need only one instance of the class like NetworkService, DatabaseService, etc. Generally, it is done because Continue Reading

Kotlin : Use of Collections

Reading Time: 3 minutes Collections The Kotlin Standard Library provides a comprehensive set of tools for managing collections – groups of a variable number of items that are significant to the problem being solved and are commonly operated on. Collections are a common concept for most programming languages, usually containing a number of objects (elements,items) of the same type. The following collection types are relevant for Kotlin: List is an ordered collection Continue Reading