# kotlin-standard-library

Published articles for kotlin-standard-library.

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

## Kotlin 2.4 Brings Swift-Style Collection Syntax \[\]

DevFeed: [Kotlin 2.4 Brings Swift-Style Collection Syntax \[\]](<https://devfeed.tech/articles/kotlin-2-4-brings-swift-style-collection-syntax-25983.md>)

Original publisher: [Read original article](<https://proandroiddev.com/kotlin-2-4-brings-swift-style-collection-syntax-0ab7097aa166?source=rss-711ab22c5c77------2>)

Author: Nav Singh

Published: 2026-06-04T16:32:23Z

Content type: article

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>), [Boilerplate](<https://devfeed.tech/topics/boilerplate.md>), [Code](<https://devfeed.tech/topics/code.md>), [Compiler](<https://devfeed.tech/topics/compiler.md>)

Tags: [build](<https://devfeed.tech/tags/build.md>), [collection](<https://devfeed.tech/tags/collection.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [experimental](<https://devfeed.tech/tags/experimental.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-2](<https://devfeed.tech/tags/kotlin-2.md>), [kotlin-standard-library](<https://devfeed.tech/tags/kotlin-standard-library.md>), [new-features](<https://devfeed.tech/tags/new-features.md>), [syntax](<https://devfeed.tech/tags/syntax.md>)

### AI overview

This article explains Kotlin 2.4's experimental collection literals, which allow collections to be initialized with bracket syntax instead of functions such as listOf() or mutableListOf(). It also covers enabling the feature with the compiler option and discusses explicit declarations and type inference.

### Source excerpt

Image generated using Perplexity In Kotlin 2.4, collection literals are introduced, making collection initialization more concise and readable. To define collections, we no longer need to use functions like listOf() or mutableListOf(). This reduces boilerplate and makes intent clearer at a glance, especially when working with simple, static data. It's currently an experimental feature. We need to opt in, and the syntax or behavior may evolve in future releases. Add the Xcollection-literals compiler option to the build file kotlin { jvmToolchain(21) compilerOptions { freeCompilerArgs.add("-Xcollection-literals") } }Code samples Bracket syntax [] + explicit declaration // Mutable list with explicit type declaration // val plFNames: MutableList<String> = mutableListOf("Joe", "Alice") // Mutable list with brackets syntax val plFNames: MutableList<String> = ["Joe", "Alice"] println(plFNames) // ["Joe", "Alice" ] Bracket syntax [] + type inference As per docs:Compiler defaults to List if it lacks sufficient information to infer the collection type.But it seems like Array as we can see in the screenshot 📸 👇 val plFNames = ["Joe", "Alice"] println(plFNames) // ["Joe", "Alice" ]Screenshot type inference -- typeReferences What's new in Kotlin 2.4.0 | Kotlin Kotlin 2.4 Brings Swift-Style Collection Syntax [] was originally published in ProAndroidDev on Medium, where people are continuing the conversation by highlighting and responding to this story.

## 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

## Hidden Gems of the Kotlin Standard Library - List

DevFeed: [Hidden Gems of the Kotlin Standard Library - List](<https://devfeed.tech/articles/hidden-gems-of-the-kotlin-standard-library-list-25100.md>)

Original publisher: [Read original article](<https://dladukedev.com/articles/045_hidden_gems_kotlin_standard_lib/>)

Published: 2024-10-03T00:00:00Z

Content type: tutorial

Language: en

Sources: [Donovan LaDuke - Developer](<https://devfeed.tech/sources/donovan-laduke-developer.md>)

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

Tags: [function](<https://devfeed.tech/tags/function.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-standard-library](<https://devfeed.tech/tags/kotlin-standard-library.md>), [library](<https://devfeed.tech/tags/library.md>), [list](<https://devfeed.tech/tags/list.md>), [overview](<https://devfeed.tech/tags/overview.md>), [sealed-class](<https://devfeed.tech/tags/sealed-class.md>), [standard](<https://devfeed.tech/tags/standard.md>), [standard-library](<https://devfeed.tech/tags/standard-library.md>)

### AI overview

An overview of useful Kotlin Standard Library functions for working with lists, including orEmpty, filterIsInstance, distinctBy, chunked, and random.

### Source excerpt

An overview of several hidden gem List Functions in the Kotlin Standard Library

## Continuation\<R, A\> in Kotlin

DevFeed: [Continuation\<R, A\> in Kotlin](<https://devfeed.tech/articles/continuation-r-a-in-kotlin-25512.md>)

Original publisher: [Read original article](<http://nomisrev.github.io/continuation-monad-in-kotlin/>)

Author: Simon Vergauwen

Published: 2021-11-28T00:00:00Z

Content type: tutorial

Language: en

Sources: [nomisRev](<https://devfeed.tech/sources/nomisrev.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Coroutines](<https://devfeed.tech/topics/coroutines.md>), [Functional programming](<https://devfeed.tech/topics/functional-programming.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [continuation](<https://devfeed.tech/tags/continuation.md>), [coroutines](<https://devfeed.tech/tags/coroutines.md>), [effect](<https://devfeed.tech/tags/effect.md>), [either](<https://devfeed.tech/tags/either.md>), [exception](<https://devfeed.tech/tags/exception.md>), [functional-programming](<https://devfeed.tech/tags/functional-programming.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-standard-library](<https://devfeed.tech/tags/kotlin-standard-library.md>), [monad](<https://devfeed.tech/tags/monad.md>), [suspend-function](<https://devfeed.tech/tags/suspend-function.md>), [syntax](<https://devfeed.tech/tags/syntax.md>)

### AI overview

A Kotlin tutorial introduces Continuation Passing Style and typed computations that can represent either a successful result or a typed failure. It develops an Effect type implemented as a suspend function and demonstrates a DSL for validation and file-reading examples.

### Source excerpt

Coroutines is one of the most liked features in Kotlin. Most people are familiar with the KotlinX Coroutines implementation, and many are also familiar with suspendCoroutine from the Kotlin Standard Library and then have also come across Continuation.

## 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

## with() (scope function)

DevFeed: [with() (scope function)](<https://devfeed.tech/articles/with-scope-function-25030.md>)

Original publisher: [Read original article](<https://typealias.com/concepts/with/>)

Author: author@typealias.com (Dave Leeds)

Published: 2017-09-14T01:00:44Z

Content type: tutorial

Language: en

Sources: [Dave Leeds on Kotlin - typealias.com](<https://devfeed.tech/sources/dave-leeds-on-kotlin-typealias-com.md>)

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

Tags: [guide](<https://devfeed.tech/tags/guide.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-standard-library](<https://devfeed.tech/tags/kotlin-standard-library.md>), [programming](<https://devfeed.tech/tags/programming.md>), [receiver](<https://devfeed.tech/tags/receiver.md>), [scope-function](<https://devfeed.tech/tags/scope-function.md>), [scope-functions](<https://devfeed.tech/tags/scope-functions.md>), [with](<https://devfeed.tech/tags/with.md>)

### AI overview

An overview of Kotlin's with() scope function, including how it accepts a receiver as an argument, makes that receiver available inside a code block, and returns the block's result. It also covers an initialization-and-execution use case and compares with() with related scope functions.

### Source excerpt

Overview The with() function is a scope function found in the Kotlin standard library. Unlike let(), also(), run() with receiver, and apply(), with() is not an extension function, but instead accepts the receiver as an argument. Example val size = with("Hello") { println(this) length } In this example, the string "Hello" is printed, and then its length is assigned to the size variable. Characteristics When the with() extension function executes:

## apply() (scope function)

DevFeed: [apply() (scope function)](<https://devfeed.tech/articles/apply-scope-function-25008.md>)

Original publisher: [Read original article](<https://typealias.com/concepts/apply/>)

Author: author@typealias.com (Dave Leeds)

Published: 2017-09-04T20:06:46Z

Content type: tutorial

Language: en

Sources: [Dave Leeds on Kotlin - typealias.com](<https://devfeed.tech/sources/dave-leeds-on-kotlin-typealias-com.md>)

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

Tags: [also](<https://devfeed.tech/tags/also.md>), [apply](<https://devfeed.tech/tags/apply.md>), [code](<https://devfeed.tech/tags/code.md>), [extension-function](<https://devfeed.tech/tags/extension-function.md>), [function](<https://devfeed.tech/tags/function.md>), [guide](<https://devfeed.tech/tags/guide.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-standard-library](<https://devfeed.tech/tags/kotlin-standard-library.md>), [let](<https://devfeed.tech/tags/let.md>), [library](<https://devfeed.tech/tags/library.md>), [object](<https://devfeed.tech/tags/object.md>), [overview](<https://devfeed.tech/tags/overview.md>), [programming](<https://devfeed.tech/tags/programming.md>), [receiver](<https://devfeed.tech/tags/receiver.md>), [scope-function](<https://devfeed.tech/tags/scope-function.md>), [scope-functions](<https://devfeed.tech/tags/scope-functions.md>), [standard](<https://devfeed.tech/tags/standard.md>), [standard-library](<https://devfeed.tech/tags/standard-library.md>), [val](<https://devfeed.tech/tags/val.md>), [variable](<https://devfeed.tech/tags/variable.md>)

### AI overview

An overview of Kotlin's apply() scope function, including its receiver and return value, with examples of using it to initialize objects and configure Android code.

### Source excerpt

Overview The apply() function is a commonly-used scope function defined in the Kotlin standard library. It's frequently used for initializing an object after instantiation. Example val size = "Hello".apply { println(this) }.length In this example, the string "Hello" is printed, and then its length is assigned to the size variable. Characteristics When the apply() extension function executes: the receiver object that .apply() is called upon is available as this the result will be the receiver object Initializing an Object It's common to use apply() to initialize an object after it's been created.

## let() (scope function)

DevFeed: [let() (scope function)](<https://devfeed.tech/articles/let-scope-function-25019.md>)

Original publisher: [Read original article](<https://typealias.com/concepts/let/>)

Author: author@typealias.com (Dave Leeds)

Published: 2017-09-04T19:54:18Z

Content type: tutorial

Language: en

Sources: [Dave Leeds on Kotlin - typealias.com](<https://devfeed.tech/sources/dave-leeds-on-kotlin-typealias-com.md>)

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

Tags: [extension-function](<https://devfeed.tech/tags/extension-function.md>), [function-reference](<https://devfeed.tech/tags/function-reference.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-standard-library](<https://devfeed.tech/tags/kotlin-standard-library.md>), [lambda](<https://devfeed.tech/tags/lambda.md>), [let](<https://devfeed.tech/tags/let.md>), [programming](<https://devfeed.tech/tags/programming.md>), [receiver](<https://devfeed.tech/tags/receiver.md>), [scope](<https://devfeed.tech/tags/scope.md>), [scope-function](<https://devfeed.tech/tags/scope-function.md>), [transformation](<https://devfeed.tech/tags/transformation.md>)

### AI overview

A reference guide to Kotlin's let() scope function. It explains how the receiver object is passed as the lambda argument, how let() returns the code block's result, and how it can transform objects. It also compares let() with direct property or function access, extension functions, and map().

### Source excerpt

Overview The let() function is one of a handful of scope functions defined in the Kotlin standard library. Example val size = "Hello".let { println(it) it.length } In this example, the string "Hello" is printed, and then its length is assigned to the size variable. Characteristics When the let() extension function executes: the receiver object that .let() is called upon is available as the lambda argument - by default, named it the result of let() will be the result of the code block passed to it Transformation The let() method is frequently used to transform an object.

## Scope Functions

DevFeed: [Scope Functions](<https://devfeed.tech/articles/scope-functions-25023.md>)

Original publisher: [Read original article](<https://typealias.com/concepts/scope-functions/>)

Author: author@typealias.com (Dave Leeds)

Published: 2017-09-04T02:33:15Z

Content type: article

Language: en

Sources: [Dave Leeds on Kotlin - typealias.com](<https://devfeed.tech/sources/dave-leeds-on-kotlin-typealias-com.md>)

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

Tags: [also](<https://devfeed.tech/tags/also.md>), [apply](<https://devfeed.tech/tags/apply.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-standard-library](<https://devfeed.tech/tags/kotlin-standard-library.md>), [let](<https://devfeed.tech/tags/let.md>), [library](<https://devfeed.tech/tags/library.md>), [programming](<https://devfeed.tech/tags/programming.md>), [receiver](<https://devfeed.tech/tags/receiver.md>), [run](<https://devfeed.tech/tags/run.md>), [scope](<https://devfeed.tech/tags/scope.md>), [scope-functions](<https://devfeed.tech/tags/scope-functions.md>), [with](<https://devfeed.tech/tags/with.md>)

### AI overview

This article explains Kotlin scope functions: commonly used functions in the Kotlin standard library that place an object in a new scope, including also(), apply(), let(), run(), and with().

### Source excerpt

Scope functions consist of the often-used functions from Standard.kt in the Kotlin standard library that take an object and put it into a new scope, such as this or it. also() apply() let() run() (with receiver) with()

## API request in Android the easy way using Kotlin

DevFeed: [API request in Android the easy way using Kotlin](<https://devfeed.tech/articles/api-request-in-android-the-easy-way-using-kotlin-27134.md>)

Original publisher: [Read original article](<https://antonioleiva.com/api-request-kotlin>)

Published: 2015-07-21T00:00:00Z

Content type: tutorial

Language: en

Sources: [Antonio Leiva](<https://devfeed.tech/sources/antonio-leiva.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Android](<https://devfeed.tech/topics/android.md>), [API](<https://devfeed.tech/topics/api.md>), [Java](<https://devfeed.tech/topics/java.md>), [interoperability](<https://devfeed.tech/topics/interoperability.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [api](<https://devfeed.tech/tags/api.md>), [asynchronous](<https://devfeed.tech/tags/asynchronous.md>), [code](<https://devfeed.tech/tags/code.md>), [java](<https://devfeed.tech/tags/java.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-standard-library](<https://devfeed.tech/tags/kotlin-standard-library.md>), [ui](<https://devfeed.tech/tags/ui.md>)

### AI overview

A tutorial on making API requests in Android with Kotlin. It compares Kotlin and Java approaches for retrieving JSON, explains using Kotlin extension functions and transformations, and discusses asynchronous HTTP work to avoid blocking the Android main thread, including an Anko DSL example.

### Source excerpt

Everything Android, Kotlin and other random topics