Sometimes it’s easy to destructure an object into multiple variables of different properties instead of calling it again and again using .
operator on the property or instance itself. It is beneficial for a few reasons like,
Nested and Inner classes are two important concepts in Kotlin that allow developers to organize and structure their code in a more effective way. In this blog, we’ll explore these concepts and understand how they can be used in Kotlin.
…The collection is something which is used by almost everyone. It makes our life easy. List
, Set
and Map
are the best examples of them.
The collection is something which is used by almost everyone. It makes our life easy. List
, Set
and Map
are the best examples of them.
The collection is something which is used by almost everyone. It makes our life easy. List
, Set
and Map
are the best examples of them.
The collection is something which is used by almost everyone. It makes our life easy. List
, Set
and Map
are the best examples of them.
Rounding up to the nearest Integer value functionality is something required a lot of times. Kotlin has a few inbuilt functions which can do the rounding up for us but they are a bit confusing. To decide when to use what, we need to understand which rounding function rounds up in which direction and which data types it can round up.
…Range Operator in Kotlin is a basic operator that is used to operate over a range. A range can be defined with a start value and an end value with and without inclusion.
…Collections (Sets
, Maps
and Lists
) are something we use daily. Traversing (Iteration) is the most common operation we perform over any collection.
Since object creation is a heavy process as it initialises all the public and private properties defined in that class when the constructor is called, Kotlin has few ways to initialise properties later when required. We already discussed lateinit properties and lazy properties.
…Object creation is a heavy process. When we create a class object, all the public and private properties of that class are initialised inside the constructor. Every variable inside a class initialisation requires a certain amount of time to allocate the memory on the heap and hold its reference on the stack. The more variables, the more time it may take but since the time is in microseconds or even less, it’s not observable.
…After reading my last blog about Kotlin with function, a lot of developers have asked me about, why with
is not an extension to Template
class like other scope functions?
Kotlin has made our life very easy by providing features like extension functions, nullability check and much more. One such kind of really helpful feature is Scope functions. Once you understand what scope functions are, you will not able to resist yourself from using them.
…Kotlin has made our life very easy by providing features like extension functions, nullability check and much more. One such kind of really helpful feature is Scope functions. Once you understand what scope functions are, you will not able to resist yourself from using them.
…In continuation to my previous post where I explained about Kotlin let function and Kotlin apply function, let’s try to understand today about also
function today.
Kotlin is a powerful language that reduces a lot of boilerplate code required to perform basic operations in comparison to Java. The classic examples for the same are any
, non
and all
functions which were added to the Iterable interface and Map interface.
Kotlin is a powerful language that reduced a lot of boilerplate code when compared to Java. The single expression function is the same in terms of reducing the boilerplate code.
…Generics in any language is the powerful features that allow us to define classes, methods and properties which are accessible using different data types while keeping a check of the compile-time type safety.
…Enums are special classes which limit the possible values of an object for that class. The possible values defined for that class are final or unchangeable.
…“how are extension functions resolved?”
This question is being asked by almost everyone both in and outside the interviews.
Even I have asked this question to many candidates during the interview.
…