Soumak De has Published 84 Articles

Creating POJO Class for Kotlin

Soumak De

Soumak De

Updated on 16-Mar-2022 12:17:12

2K+ Views

Kotlin has been developed over JVM and hence it is fully compatible with JVM. Java POJO class stands for Plain Old Java Object (POJO) which is used to hold the data.In Java, along with defining the variables, we need to create different supporting methods in order to access those private ... Read More

Getters and Setters in Kotlin

Soumak De

Soumak De

Updated on 16-Mar-2022 12:12:45

542 Views

Properties in Kotlin can be declared either as mutable using the "var" keyword or as read-only using the "val" keyword. Both these types of variables can be referred by their respective names after the method declaration.In Kotlin, getter() and setter() methods need not be created explicitly. The Kotlin library provides ... Read More

Difference between isNullOrEmpty and isNullOrBlank in Kotlin

Soumak De

Soumak De

Updated on 16-Mar-2022 12:09:22

1K+ Views

Both these functions, isNullOrEmpty and isNullOrBlank, are used in Kotlin whenever it is required to check if a String value is empty or not. Let's check how these two functions are different from each other.isNullOrBlank – It takes whitespaces into account, which means " " is different from "". This ... Read More

IntArray vs. Array in Kotlin

Soumak De

Soumak De

Updated on 16-Mar-2022 11:59:20

7K+ Views

In this article, we will take an example to show the difference between IntArray and Arrayin Kotlin.IntArray in KotlinIntArray is a class in Kotlin representing the array of elements. Each instance of this class is represented as an integer array. To the constructor of this class you need to pass ... Read More

What does the "===" operator do in Kotlin?

Soumak De

Soumak De

Updated on 16-Mar-2022 11:40:59

273 Views

In Kotlin, the "===" operator checks the referential equality of two objects. Any expression "a===b" will evaluate to True if and only if both "a" and "b" point to the same object. That is, both "a" and "b" share the same address.In contrast, we can use the "==" operator to ... Read More

Kotlin static methods and variables

Soumak De

Soumak De

Updated on 16-Mar-2022 11:34:55

6K+ Views

In Java, once a method is declared as "static", it can be used in different classes without creating an object. With static methods, we don't have to create the same boilerplate code for each and every class. Here we will take an example to demonstrate how Kotlin implements static methods.Example ... Read More

How to print all the elements of a String array in Kotlin in a single line?

Soumak De

Soumak De

Updated on 01-Mar-2022 13:28:41

472 Views

In this article, we will take an example and show how to print all the elements of a String array in a single line using a Kotlin library class. In order to do that, we will use a String function called joinToString(), provided by the Kotlin library.As per the Kotlin documentation, ... Read More

How to add an item to a list in Kotlin?

Soumak De

Soumak De

Updated on 01-Mar-2022 12:10:04

665 Views

A List is a collection where you can store same type of data in one place. There are two types of lists in Kotlin −An Immutable list is something that cannot be modified. It is read-only in nature.The other type of list is mutable which can be modified.In this article, ... Read More

How to get the current local date and time in Kotlin?

Soumak De

Soumak De

Updated on 01-Mar-2022 12:07:10

3K+ Views

Kotlin is a statistically typed language and it is based on Java, hence all the Java codes can easily be compiled within Kotlin. In this article, we will see how we can generate the current local date and time in Kotlin.As Kotlin is interoperable with Java, we will be using ... Read More

How to convert Int to Hex String in Kotlin?

Soumak De

Soumak De

Updated on 01-Mar-2022 12:03:40

781 Views

Kotlin is statistically typed language and it is built on JVM. Kotlin is cent percent comparable with Java. Hence, some of the Java functions can be used in Kotlin as well.In this article, we will take an example to demonstrate how we can use a Java class function convert an ... Read More

Advertisements