# kotlin-beginners

Published articles for kotlin-beginners.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## Simplify Sorted-Order Validation with Kotlin 2.4.0's New Extensions

DevFeed: [Simplify Sorted-Order Validation with Kotlin 2.4.0's New Extensions](<https://devfeed.tech/articles/simplify-sorted-order-validation-with-kotlin-2-4-0-s-new-extensions-25978.md>)

Original publisher: [Read original article](<https://navczydev.medium.com/simplify-sorted-order-validation-with-kotlin-2-4-0s-new-extensions-b48b1ac10521?source=rss-711ab22c5c77------2>)

Author: Nav Singh

Published: 2026-04-06T02:23:40Z

Content type: tutorial

Language: en

Sources: [Stories by Nav Singh 🇨🇦 on Medium](<https://devfeed.tech/sources/stories-by-nav-singh-on-medium.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Library](<https://devfeed.tech/topics/library.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [extension](<https://devfeed.tech/tags/extension.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-2](<https://devfeed.tech/tags/kotlin-2.md>), [kotlin-beginners](<https://devfeed.tech/tags/kotlin-beginners.md>), [kotlin-standard-library](<https://devfeed.tech/tags/kotlin-standard-library.md>), [library](<https://devfeed.tech/tags/library.md>), [sortedlist](<https://devfeed.tech/tags/sortedlist.md>), [sorting](<https://devfeed.tech/tags/sorting.md>), [standard-library](<https://devfeed.tech/tags/standard-library.md>)

### AI overview

This article introduces Kotlin 2.4.0-Beta1 standard-library extension functions for checking whether collections are sorted. It covers ascending, descending, comparator-based, and selector-based checks, which return true for correctly ordered collections or collections with fewer than two elements. The checks stop when they find an unordered pair.

### Source excerpt

Image generated using Perplexity Kotlin 2.4.0-Beta1 introduces a small but powerful addition to the standard library: a set of new extension functions that lets us check whether a collection is already sorted. With these extension functions, we can check whether elements have already been sorted without resorting them. New Functions .isSorted() .isSortedDescending() .isSortedWith(comparator) .isSortedBy(selector) .isSortedByDescending(selector) All of these return true if: The elements are in the expected order, or The collection has fewer than two elements.These functions are optimized -- they stop checking as soon as an unordered pair is found, so they handle large inputs efficiently.Code samplesdata class User(val name: String, val age: Int)fun main() { val numbers = listOf(0, 1, 2, 3, 4, 5, 6, 7, 8, 9) println("Numbers: isSorted") println(numbers.isSorted()) // true println("Is sorted descending") println(numbers.isSortedDescending()) // false // Users list val users = listOf( User("Alice", 21), User("Balley", 34), User("Charles", 29), ) println("Users: isSorted by Age") println(users.isSortedBy(User::age)) // false val comparator = Comparator<User>{ user, user2 -> user.name.length.compareTo(user2.name.length) } println("Users: isSortedWith(comparator)") val sortedList = users.sortedWith(comparator) println("Users: Name by length ${sortedList.joinToString()}") // Output: Users: Name by length User(name=Bob, age=31), User(name=Alice, age=24), User(name=Charlie, age=29) println(sortedList.isSortedWith(comparator)) // true }References What's new in Kotlin 2.4.0-Beta1 | Kotlin

## KMM: What's Under the hood?

DevFeed: [KMM: What's Under the hood?](<https://devfeed.tech/articles/kmm-what-s-under-the-hood-24754.md>)

Original publisher: [Read original article](<https://medium.com/ymedialabs-innovation/kmm-whats-under-the-hood-1a26cb50ca67?source=rss----8b5620c36355---4>)

Author: Codeangi

Published: 2023-02-22T15:58:32Z

Content type: tutorial

Language: en

Sources: [ymedialabs-innovation - Medium](<https://devfeed.tech/sources/ymedialabs-innovation-medium.md>)

Topics: [Kotlin Multiplatform](<https://devfeed.tech/topics/kotlin-multiplatform.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Mobile](<https://devfeed.tech/topics/mobile.md>), [multiplatform](<https://devfeed.tech/topics/multiplatform.md>), [kotlin-native](<https://devfeed.tech/topics/kotlin-native.md>), [LLVM](<https://devfeed.tech/topics/llvm.md>), [Compiler](<https://devfeed.tech/topics/compiler.md>), [JavaScript](<https://devfeed.tech/topics/javascript.md>), [toolchain](<https://devfeed.tech/topics/toolchain.md>), [Development](<https://devfeed.tech/topics/development.md>)

Tags: [compilation](<https://devfeed.tech/tags/compilation.md>), [development](<https://devfeed.tech/tags/development.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [kmm](<https://devfeed.tech/tags/kmm.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-beginners](<https://devfeed.tech/tags/kotlin-beginners.md>), [kotlin-multiplatform](<https://devfeed.tech/tags/kotlin-multiplatform.md>), [kotlin-native](<https://devfeed.tech/tags/kotlin-native.md>), [llvm](<https://devfeed.tech/tags/llvm.md>), [mobile](<https://devfeed.tech/tags/mobile.md>), [mobile-development](<https://devfeed.tech/tags/mobile-development.md>), [multiplatform](<https://devfeed.tech/tags/multiplatform.md>), [toolchain](<https://devfeed.tech/tags/toolchain.md>)

### AI overview

This article explains Kotlin Multiplatform Mobile (KMM), focusing on how developers can share business logic, data, and connectivity implementation between Android and iOS. It also describes Kotlin/Native compilation through LLVM and Kotlin/JS compilation to JavaScript.

### Source excerpt

source There have been many tools for cross-platform development before but offered so little in terms of sharable code, there was always an overhead of writing and maintaining applications in a set-predetermined technology such as Phonegap, ReactNative, and Flutter. Kotlin provides a huge leeway in writing sharable code, especially when you are developing Mobile applications for Android and iOS with similar features. In the real world, it translates into fewer lines of code, fewer bugs, less time, and of course lesser cost of development. Whether you are starting a new project or adding a new feature to an existing one. This article is an effort to interpret KMM in layman's terms, knowing programming helps but is not mandatory.Topics Include: What is KMM, How it works, the Good, and the Bad.source Kotlin is a cutting-edge yet established programming language that offers a range of benefits for developers. One of the key use cases for Kotlin is its ability to share code between mobile platforms through Kotlin Multiplatform Mobile (KMM). By using KMM, developers can create cross-platform mobile apps and share crucial elements like business logic, data, and connectivity implementation between Android and iOS. Kotlin-Native In order to use Kotlin code in iOS, the Kotlin code is first compiled to LLVM bytecode using the Kotlin/Native compiler. LLVM (Low Level Virtual Machine) is a collection of modular and reusable compiler and toolchain technologies. The LLVM bytecode is then compiled using the iOS toolchain and linked with the iOS runtime libraries. The resulting binary is an iOS application bundle (an .app directory) that contains the Kotlin code and the Swift runtime. When the app is run, the Swift runtime loads the Kotlin code and uses it as if it were native Swift code. Kotlin/JS Kotlin/JS provides the ability to trans-compile Kotlin code, the Kotlin standard library, and any compatible dependencies to JavaScript. The current implementation of Kotlin/JS targets ES

## Using the Kotlin standard library in Java

DevFeed: [Using the Kotlin standard library in Java](<https://devfeed.tech/articles/using-the-kotlin-standard-library-in-java-25888.md>)

Original publisher: [Read original article](<https://medium.com/google-developer-experts/using-the-kotlin-standard-library-in-java-ea0766deac10?source=rss-1331e67af4e1------2>)

Author: Danny Preussler

Published: 2021-06-14T19:01:08Z

Content type: tutorial

Language: en

Sources: [Stories by Danny Preussler on Medium](<https://devfeed.tech/sources/stories-by-danny-preussler-on-medium.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Java](<https://devfeed.tech/topics/java.md>), [Library](<https://devfeed.tech/topics/library.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [collections](<https://devfeed.tech/tags/collections.md>), [dependencies](<https://devfeed.tech/tags/dependencies.md>), [java](<https://devfeed.tech/tags/java.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-beginners](<https://devfeed.tech/tags/kotlin-beginners.md>), [kotlin-standard-library](<https://devfeed.tech/tags/kotlin-standard-library.md>), [libraries](<https://devfeed.tech/tags/libraries.md>), [standard-library](<https://devfeed.tech/tags/standard-library.md>)

### AI overview

This tutorial explains how Java code can use Kotlin standard-library functions through static imports. It covers list creation, Kotlin free functions compiled into classes, and extension functions exposed to Java with the receiver as the first argument.

### Source excerpt

Using the Kotlin standard library from Javagiphy.com If you work with Kotlin on a daily basis you probably love the language and don't want to go back to Java. Though, many of us work on a codebase that isn't purely Kotlin. Our Android codebase at SoundCloud still has a fair amount of code written in Java. This percentage gets smaller over time but there is no urgent need for mass migration of the remains right now. Therefore, every once in a while, I find myself, changing Java files. In those cases, I miss some of the Kotlin functions I'm used to; I can easily think of string manipulation or handling collections as examples. Of course, Java has powerful utility libraries such as Googles Guava or Apache Commons, libraries many of which we used to work with in the world before Kotlin. But when writing Kotlin code all day, remembering those "older" APIs is sometimes hard. It is a complete context switch. It would be much easier to use what we use in Kotlin. And you should! Let me show you! Let's assume we want to create a list of items. In Kotlin, we would write: val items = listOf( items1, item2, item3 ) In Java, I would write it as: List<Item> items = Arrays.asList(item1, item2, items3); Usage is pretty much the same but you still need to remember the name of the function. Wouldn't it be easier to just use: List<Item> items = listOf(item1, item2, items3); And yes you can! All you need to do is to static importthat function! This works aslistOf, like many of our daily Kotlin utility functions, are simply static functions you can use from Java. And even better, as your project already uses Kotlin, you already got those dependencies included anyway, no additional library needed. A closer look If you would click on the details of listOf from Kotlin, you would end up in a file called Collections.kt and the definition looks like this: public fun <T> listOf(vararg elements: T): List<T> It is a free function, not bound to any class. But from a Java perspective this looks so