# extension function

Published articles for extension function.

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

## Reusable Styles in Compose

DevFeed: [Reusable Styles in Compose](<https://devfeed.tech/articles/reusable-styles-in-compose-25101.md>)

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

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

Content type: tutorial

Language: en

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

Topics: [Jetpack Compose](<https://devfeed.tech/topics/jetpack-compose.md>), [ui](<https://devfeed.tech/topics/ui.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [compose](<https://devfeed.tech/tags/compose.md>), [extension-function](<https://devfeed.tech/tags/extension-function.md>), [function](<https://devfeed.tech/tags/function.md>), [layout](<https://devfeed.tech/tags/layout.md>), [maintenance](<https://devfeed.tech/tags/maintenance.md>), [reuse](<https://devfeed.tech/tags/reuse.md>)

### AI overview

This article explains how to create reusable styles in Jetpack Compose by grouping shared modifier chains into reusable modifier functions. It discusses applying padding, borders, and card styling across layout components, while warning against excessive nesting and overuse of abstraction.

### Source excerpt

Leverage Modifier chains to create reusable styles in Compose

## Coroutines and Dispatchers

DevFeed: [Coroutines and Dispatchers](<https://devfeed.tech/articles/coroutines-and-dispatchers-22871.md>)

Original publisher: [Read original article](<https://medium.com/mindorks/coroutines-and-dispatchers-b559094b828e?source=rss----f1a763fc7443---4>)

Author: Bigyan Thapa

Published: 2024-10-16T06:48:00Z

Content type: tutorial

Language: en

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

Topics: [Coroutines](<https://devfeed.tech/topics/coroutines.md>), [android-development](<https://devfeed.tech/topics/android-development.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Development](<https://devfeed.tech/topics/development.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-development](<https://devfeed.tech/tags/android-development.md>), [androiddev](<https://devfeed.tech/tags/androiddev.md>), [best-practices](<https://devfeed.tech/tags/best-practices.md>), [code-quality](<https://devfeed.tech/tags/code-quality.md>), [coroutine](<https://devfeed.tech/tags/coroutine.md>), [coroutines](<https://devfeed.tech/tags/coroutines.md>), [dispatcher](<https://devfeed.tech/tags/dispatcher.md>), [extension](<https://devfeed.tech/tags/extension.md>), [extension-function](<https://devfeed.tech/tags/extension-function.md>), [io](<https://devfeed.tech/tags/io.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [main-thread](<https://devfeed.tech/tags/main-thread.md>)

### AI overview

This tutorial explains how Android ViewModel coroutines use viewModelScope and how to select Dispatchers.IO, Dispatchers.Default, or Dispatchers.Main for I/O, CPU-intensive, and UI work. It also presents ViewModel extension functions and an overloaded function to standardize coroutine launching.

### Source excerpt

In Android development, coroutines are commonly launched from ViewModel classes using viewModelScope. The typical usage looks like this: viewModelScope.launch { // ... implementation } In Android development, coroutines are commonly launched from ViewModel classes using viewModelScope. The typical usage looks like this: viewModelScope.launch { // ... implementation } By default, if a dispatcher is not specified, any coroutine launched in viewModelScope will run on the main thread. However, in most use cases, we launch these coroutines to perform background tasks, such as -- making API calls, or database operations. To ensure these tasks run in the background thread, it is essential to specify an appropriate dispatcher: I/O tasks should use Dispatchers.IO CPU-intensive tasks should use Dispatchers.Default UI updates should use Dispatchers.Main For example, to run an I/O task, we can specify the dispatcher like this: viewModelScope.launch(Dispatchers.IO) { // ...implementation }Optimizing Coroutine Launching To streamline coroutine launching, we can create extension functions on ViewModel that automatically use the specified dispatcher by default. Step 1: Create Extension Functions We can define extension functions for different dispatchers: kotlin fun ViewModel.launchIO(block: suspend CoroutineScope.() -> Unit) { viewModelScope.launch(Dispatchers.IO, block = block) } fun ViewModel.launchDefault(block: suspend CoroutineScope.() -> Unit) { viewModelScope.launch(Dispatchers.Default, block = block) } fun ViewModel.launchMain(block: suspend CoroutineScope.() -> Unit) { viewModelScope.launch(Dispatchers.Main, block = block) }Step 2: Use the Extension Functions You can now use these extension functions in your ViewModel as follows: class MyViewModel : ViewModel() { fun fetchData() { launchIO { // ... implementation } } } Benefits Consistency: These extension functions maintain consistent coroutine usage for specific tasks. Readability: The function names clearly indicate their p

## Extensions in Kotlin

DevFeed: [Extensions in Kotlin](<https://devfeed.tech/articles/extensions-in-kotlin-39331.md>)

Original publisher: [Read original article](<https://kt.academy/article/kfde-extensions>)

Published: 2023-10-09T00:01:00Z

Content type: tutorial

Language: en

Sources: [Kt. Academy](<https://devfeed.tech/sources/kt-academy.md>)

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

Tags: [bytecode](<https://devfeed.tech/tags/bytecode.md>), [extension](<https://devfeed.tech/tags/extension.md>), [extension-function](<https://devfeed.tech/tags/extension-function.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [static](<https://devfeed.tech/tags/static.md>), [workshop-learning-programming](<https://devfeed.tech/tags/workshop-learning-programming.md>)

### AI overview

This tutorial explains Kotlin extension functions and properties, including how they are defined, called on receiver instances, and used with types from external APIs. It also examines their JVM implementation, where an extension receiver becomes a regular parameter in a static function.

### Source excerpt

What are extensions in Kotlin and how do we use them.

## Building a Note-Taking App in Compose

DevFeed: [Building a Note-Taking App in Compose](<https://devfeed.tech/articles/building-a-note-taking-app-in-compose-20024.md>)

Original publisher: [Read original article](<https://technology.doximity.com/articles/building-a-note-taking-app-in-compose>)

Author: Doximity

Published: 2023-07-05T19:47:00Z

Content type: tutorial

Language: en

Sources: [Doximity](<https://devfeed.tech/sources/doximity.md>)

Topics: [Jetpack Compose](<https://devfeed.tech/topics/jetpack-compose.md>), [App](<https://devfeed.tech/topics/app.md>), [Code](<https://devfeed.tech/topics/code.md>), [Template](<https://devfeed.tech/topics/template.md>)

Tags: [app](<https://devfeed.tech/tags/app.md>), [architecture](<https://devfeed.tech/tags/architecture.md>), [build](<https://devfeed.tech/tags/build.md>), [building](<https://devfeed.tech/tags/building.md>), [class](<https://devfeed.tech/tags/class.md>), [clean-architecture](<https://devfeed.tech/tags/clean-architecture.md>), [code](<https://devfeed.tech/tags/code.md>), [collect](<https://devfeed.tech/tags/collect.md>), [compose](<https://devfeed.tech/tags/compose.md>), [data-class](<https://devfeed.tech/tags/data-class.md>), [di](<https://devfeed.tech/tags/di.md>), [extension-function](<https://devfeed.tech/tags/extension-function.md>), [flow](<https://devfeed.tech/tags/flow.md>), [icons](<https://devfeed.tech/tags/icons.md>), [implement](<https://devfeed.tech/tags/implement.md>), [koin](<https://devfeed.tech/tags/koin.md>), [list](<https://devfeed.tech/tags/list.md>), [state](<https://devfeed.tech/tags/state.md>), [state-management](<https://devfeed.tech/tags/state-management.md>), [view](<https://devfeed.tech/tags/view.md>)

### AI overview

A case study showing how to build a note-taking app with Jetpack Compose. It models note state, renders the notes UI, collects note data through a presenter and Clean Architecture use cases, and plans events for adding, editing, checking, and deleting notes.

### Source excerpt

In this case study, we will build a note-taking app that lets the user add, edit and delete notes. It uses Compose for both the view and presentation layers! Note: This is a follow up to Part 1: Simplifying State Management with Compose and assumes the reader is already familiar with Jetpack Compose. The Template I find it useful to start with the model that represents the state of the screen we're building. It will have a list of notes, with each note containing properties for the text and checkbox: data class NotesUiModel(val notes: List<Note>) : UiModel { data class Note(val text: String, val isChecked: Boolean) : UiModel } It'll be the job of the presenter to produce this model. Initially, let's implement a stub to return an empty list of notes (we'll ignore parameters for now): class NotesListPresenter : Presenter<NotesUiModel, Unit> { @Composable override fun present(params: Unit): NotesUiModel { return NotesUiModel(notes = emptyList()) } } Then we can build our view to render the model that's returned by the presenter: @Composable fun NotesScreen() { val presenter: NotesListPresenter = koinInject() // we use koin for DI val uiModel = presenter.present(Unit) Column { TopAppBar(title = { Text("Notes") }) Notes(uiModel) } } } The View The views themselves are pretty self-explanatory if you're already familiar with building UIs in Compose. For the notes, we'll take in a NotesUiModel argument and create a LazyColumn with the notes property. A FAB button is used for adding new notes, although we'll skip the triggering of events and return to this part in a little bit: @Composable private fun Notes(uiModel: NotesUiModel) { Box { LazyColumn { items(uiModel.notes) { note -> Note(note) } } FloatingActionButton(onClick = { /* TODO */ }) { Icon(imageVector = Icons.Rounded.Add) } } } Then we can render each note with a checkbox, text field and delete button: @Composable private fun Note(uiModel: Note) { Row { Checkbox( checked = uiModel.isChecked, onCheckedChange = { /* T

## Five Pager Indicator Animations

DevFeed: [Five Pager Indicator Animations](<https://devfeed.tech/articles/five-pager-indicator-animations-25780.md>)

Original publisher: [Read original article](<https://www.sinasamaki.com/five-pager-indicator-animations/>)

Author: sinasamaki

Published: 2023-05-15T05:41:32Z

Content type: tutorial

Language: en

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

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

Tags: [animation](<https://devfeed.tech/tags/animation.md>), [article](<https://devfeed.tech/tags/article.md>), [examples](<https://devfeed.tech/tags/examples.md>), [extension-function](<https://devfeed.tech/tags/extension-function.md>), [how-to](<https://devfeed.tech/tags/how-to.md>)

### AI overview

A tutorial on creating custom animated pager indicators, building on pager state values and extension functions. It covers circle, line, and glow indicator examples, including animations for size, width, color, and blur.

### Source excerpt

Learn how to animate a pager indicator along with five examples

## Creating Pager Animations in Jetpack Compose

DevFeed: [Creating Pager Animations in Jetpack Compose](<https://devfeed.tech/articles/creating-pager-animations-in-jetpack-compose-25797.md>)

Original publisher: [Read original article](<https://www.sinasamaki.com/pager-animations/>)

Author: sinasamaki

Published: 2023-04-25T07:32:55Z

Content type: tutorial

Language: en

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

Topics: [Jetpack Compose](<https://devfeed.tech/topics/jetpack-compose.md>), [Compose](<https://devfeed.tech/topics/compose.md>), [ui](<https://devfeed.tech/topics/ui.md>)

Tags: [3d](<https://devfeed.tech/tags/3d.md>), [animation](<https://devfeed.tech/tags/animation.md>), [article](<https://devfeed.tech/tags/article.md>), [compose](<https://devfeed.tech/tags/compose.md>), [extension-function](<https://devfeed.tech/tags/extension-function.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [jetpack](<https://devfeed.tech/tags/jetpack.md>), [jetpack-compose](<https://devfeed.tech/tags/jetpack-compose.md>), [rotation](<https://devfeed.tech/tags/rotation.md>), [scale](<https://devfeed.tech/tags/scale.md>)

### AI overview

A tutorial on creating three animated pager transitions in Jetpack Compose. It explains how to calculate page offsets and uses those values with rotation and scale to build effects such as a cube transition.

### Source excerpt

How to create 3 unique Pager animations.

## Remove Duplicates From a List in Kotlin

DevFeed: [Remove Duplicates From a List in Kotlin](<https://devfeed.tech/articles/remove-duplicates-from-a-list-in-kotlin-25157.md>)

Original publisher: [Read original article](<https://blog.droidchef.dev/remove-duplicates-from-a-list-in-kotlin/>)

Author: Ishan Khanna

Published: 2023-01-25T20:33:45Z

Content type: tutorial

Language: en

Sources: [Ishan Khanna](<https://devfeed.tech/sources/ishan-khanna.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Data structures](<https://devfeed.tech/topics/data-structures.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [data-structure](<https://devfeed.tech/tags/data-structure.md>), [extension-function](<https://devfeed.tech/tags/extension-function.md>), [function](<https://devfeed.tech/tags/function.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [list](<https://devfeed.tech/tags/list.md>)

### AI overview

This Kotlin tutorial explains four ways to remove duplicate elements from a list: toSet(), toHashSet(), distinct(), and an extension-function approach. It compares their return types, ordering guarantees, mutability, and usage considerations.

### Source excerpt

In this article, Ishan Khanna shows you the best way to remove duplicates from a List in Kotlin.

## Operator overloading in Kotlin

DevFeed: [Operator overloading in Kotlin](<https://devfeed.tech/articles/operator-overloading-in-kotlin-39338.md>)

Original publisher: [Read original article](<https://kt.academy/article/kfde-operators>)

Published: 2023-01-23T00:01:00Z

Content type: tutorial

Language: en

Sources: [Kt. Academy](<https://devfeed.tech/sources/kt-academy.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Code](<https://devfeed.tech/topics/code.md>), [class](<https://devfeed.tech/topics/class.md>), [function](<https://devfeed.tech/topics/function.md>), [Compiler](<https://devfeed.tech/topics/compiler.md>), [Math and Logic](<https://devfeed.tech/topics/math-and-logic.md>)

Tags: [arithmetic](<https://devfeed.tech/tags/arithmetic.md>), [class](<https://devfeed.tech/tags/class.md>), [code](<https://devfeed.tech/tags/code.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [complex-numbers](<https://devfeed.tech/tags/complex-numbers.md>), [engineering](<https://devfeed.tech/tags/engineering.md>), [extension-function](<https://devfeed.tech/tags/extension-function.md>), [function](<https://devfeed.tech/tags/function.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [number](<https://devfeed.tech/tags/number.md>), [numbers](<https://devfeed.tech/tags/numbers.md>), [operations](<https://devfeed.tech/tags/operations.md>), [operator-overloading](<https://devfeed.tech/tags/operator-overloading.md>), [physics](<https://devfeed.tech/tags/physics.md>), [type](<https://devfeed.tech/tags/type.md>), [types](<https://devfeed.tech/tags/types.md>), [workshop-learning-programming](<https://devfeed.tech/tags/workshop-learning-programming.md>)

### AI overview

A tutorial on Kotlin operator overloading. It explains Kotlin's predefined operators, how operator methods are declared for custom classes, and how arithmetic and range operators are handled, using complex numbers as an example.

### Source excerpt

How are operators defined for types in Kotlin, and how can we define our own operators.

## Context receivers

DevFeed: [Context receivers](<https://devfeed.tech/articles/context-receivers-39302.md>)

Original publisher: [Read original article](<https://kt.academy/article/fk-context-receivers>)

Published: 2022-10-07T00:05:00Z

Content type: tutorial

Language: en

Sources: [Kt. Academy](<https://devfeed.tech/sources/kt-academy.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Extension](<https://devfeed.tech/topics/extension.md>), [kotlin-coroutines](<https://devfeed.tech/topics/kotlin-coroutines.md>)

Tags: [experimental](<https://devfeed.tech/tags/experimental.md>), [extension](<https://devfeed.tech/tags/extension.md>), [extension-function](<https://devfeed.tech/tags/extension-function.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-coroutines](<https://devfeed.tech/tags/kotlin-coroutines.md>), [workshop-learning-programming](<https://devfeed.tech/tags/workshop-learning-programming.md>)

### AI overview

This Kotlin article explains context receivers, an experimental feature that requires the -Xcontext-receivers compiler argument in the relevant Kotlin version. It contrasts context receivers with extension functions, which are limited to a single receiver and can give a misleading impression when used only to provide context.

### Source excerpt

All you need to know about the new and powerful Kotlin feature: context receivers.

## Receivers and Extensions

DevFeed: [Receivers and Extensions](<https://devfeed.tech/articles/receivers-and-extensions-25062.md>)

Original publisher: [Read original article](<https://typealias.com/start/kotlin-receivers-and-extensions/>)

Author: author@typealias.com (Dave Leeds)

Published: 2022-06-13T00:00:00Z

Content type: tutorial

Language: en

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

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

Tags: [explicit-receiver](<https://devfeed.tech/tags/explicit-receiver.md>), [extension](<https://devfeed.tech/tags/extension.md>), [extension-function](<https://devfeed.tech/tags/extension-function.md>), [extension-property](<https://devfeed.tech/tags/extension-property.md>), [extensions](<https://devfeed.tech/tags/extensions.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [implicit-receiver](<https://devfeed.tech/tags/implicit-receiver.md>), [introduction](<https://devfeed.tech/tags/introduction.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [learn-to-program](<https://devfeed.tech/tags/learn-to-program.md>), [programming](<https://devfeed.tech/tags/programming.md>), [receiver](<https://devfeed.tech/tags/receiver.md>)

### AI overview

A Kotlin tutorial chapter explaining how extensions add functions and properties to existing classes. It introduces explicit and implicit receivers, extension functions, and extension properties.

### Source excerpt

Kotlin extensions can be used to add new functions and properties to existing classes--even to classes that you didn't write! In this chapter, we'll cover explicit receivers, implicit receivers, extension functions, and extension properties. Buckle up! Standalone Functions and Object Functions Way back in Chapter 2, we learned how to create functions. Here's a very simple function that puts single quotes at the beginning and the end of a String.

## Composed modifiers in Jetpack Compose

DevFeed: [Composed modifiers in Jetpack Compose](<https://devfeed.tech/articles/composed-modifiers-in-jetpack-compose-27464.md>)

Original publisher: [Read original article](<https://jorgecastilloprz.github.io/composed-modifiers-in-jetpack-compose>)

Author: Jorge Castillo

Published: 2022-04-04T10:00:00Z

Content type: tutorial

Language: en

Sources: [👨💻 Jorge Castillo](<https://devfeed.tech/sources/jorge-castillo.md>)

Topics: [Jetpack Compose](<https://devfeed.tech/topics/jetpack-compose.md>), [ui](<https://devfeed.tech/topics/ui.md>), [context](<https://devfeed.tech/topics/context.md>), [factory function](<https://devfeed.tech/topics/factory-function.md>), [Library](<https://devfeed.tech/topics/library.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [compose](<https://devfeed.tech/tags/compose.md>), [compose-ui](<https://devfeed.tech/tags/compose-ui.md>), [context](<https://devfeed.tech/tags/context.md>), [extension-function](<https://devfeed.tech/tags/extension-function.md>), [factory-function](<https://devfeed.tech/tags/factory-function.md>), [jetpack](<https://devfeed.tech/tags/jetpack.md>), [jetpack-compose](<https://devfeed.tech/tags/jetpack-compose.md>), [modifiers](<https://devfeed.tech/tags/modifiers.md>), [state](<https://devfeed.tech/tags/state.md>), [stateful](<https://devfeed.tech/tags/stateful.md>), [stateless](<https://devfeed.tech/tags/stateless.md>)

### AI overview

This tutorial explains the difference between standard and composed modifiers in Jetpack Compose. Standard modifiers use extension functions and are stateless, while composed modifiers support state and access to composition context by creating them within a Composition.

### Source excerpt

Learn about composed modifiers and compare those to standard ones.

## Exploring Kotlin's Context Receivers

DevFeed: [Exploring Kotlin's Context Receivers](<https://devfeed.tech/articles/exploring-kotlin-s-context-receivers-25511.md>)

Original publisher: [Read original article](<http://nomisrev.github.io/context-receivers/>)

Author: Simon Vergauwen

Published: 2022-02-17T00:00:00Z

Content type: article

Language: en

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

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

Tags: [compiler](<https://devfeed.tech/tags/compiler.md>), [dsl](<https://devfeed.tech/tags/dsl.md>), [effect](<https://devfeed.tech/tags/effect.md>), [extension-function](<https://devfeed.tech/tags/extension-function.md>), [fp](<https://devfeed.tech/tags/fp.md>), [function](<https://devfeed.tech/tags/function.md>), [ide](<https://devfeed.tech/tags/ide.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [scope-functions](<https://devfeed.tech/tags/scope-functions.md>), [suspend](<https://devfeed.tech/tags/suspend.md>)

### AI overview

A tutorial on Kotlin Context Receivers, introduced as a preview in Kotlin 1.6.20-M1. It explains how additional receivers work, how the compiler handles them, and how they can support scope-based programming patterns such as effect handlers and logging contexts.

### Source excerpt

Last week a long awaited feature was released as a preview in Kotlin 1.6.20-M1. In this blogpost we're going to explore what Context Receivers are, and some benefits and patterns they'll enable. To try it out in your IDE, follow this guide

## Confetti Cleanup

DevFeed: [Confetti Cleanup](<https://devfeed.tech/articles/confetti-cleanup-32044.md>)

Original publisher: [Read original article](<https://www.maiatoday.net/p/confetti-cleanup/>)

Published: 2021-12-31T05:37:42Z

Content type: tutorial

Language: en

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

Topics: [Jetpack Compose](<https://devfeed.tech/topics/jetpack-compose.md>), [Code](<https://devfeed.tech/topics/code.md>), [implementation](<https://devfeed.tech/topics/implementation.md>), [function](<https://devfeed.tech/topics/function.md>)

Tags: [animate](<https://devfeed.tech/tags/animate.md>), [animation](<https://devfeed.tech/tags/animation.md>), [code](<https://devfeed.tech/tags/code.md>), [compose](<https://devfeed.tech/tags/compose.md>), [extension-function](<https://devfeed.tech/tags/extension-function.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [implementation](<https://devfeed.tech/tags/implementation.md>), [memory](<https://devfeed.tech/tags/memory.md>), [state](<https://devfeed.tech/tags/state.md>)

### AI overview

The article revisits a confetti animation modifier for Jetpack Compose and examines object allocation in its particle system. It explains how using the immutable Offset class reduces extra allocations while retaining Compose's state-change requirements, and briefly shows how to create and apply a drawing modifier.

### Source excerpt

In my exploration of animation in Jetpack Compose I built a Confetti modifier that could be applied to any composable. I first showed the modifier in my presentation for Chicago Roboto but since I made it something was bothering me. The way that I can get the state in Compose to register change is by making copies of objects or making new objects. For a modifier that uses particles this can be many objects. I profiled my original modifier and sure enough I see the object allocation and also the garbage collectore cleaning up when the confetti modifier is visible. Fast forward to Dec 2021 and my friends over at Code with Italians built a similar snow modifier. Revisiting my modifier, I cleaned it up. I managed to get rid of some of the object allocation. However since it is a particle system and each of the particles change position, it needs some form of state that changes as the position of the particles change. I used the Offset class as this is the object that a Circle needs to draw and the object has been optimised to pack the x and y floats. It also has some other useful functions and operators. Offset is immutable so if the particle changes position a new object is made. It is smaller than my original implementation. It isn't really fair to compare the screenshot below with the one above as the time over which the heap capture ran is is not the same. The shallow size of Offset is 16 and the shallow size of the original Confetto objects is 24 and the point inside the Confetto object also has a shallow size of 16. The improvements eliminated the allocation of the extra Confetto object. My intuition says it is preferable to sprinkle the memory with fewer smaller pieces of confetti rather than many larger ones. Still there isn't really a way around it since Offset is immutable and Compose is built around tracking unidirectional state flow. Mutable State holder classes won't register a change if the object that holds the state doesn't change. This means if I keep a

## Build function chains using composition in Kotlin

DevFeed: [Build function chains using composition in Kotlin](<https://devfeed.tech/articles/build-function-chains-using-composition-in-kotlin-28373.md>)

Original publisher: [Read original article](<https://siddroid.com/post/kotlin/build-function-chains-using-composition-in-kotlin/>)

Author: Siddhesh Patil

Published: 2021-08-24T06:36:12Z

Content type: tutorial

Language: en

Sources: [Sid Patil - Android Engineer and Kotlin Advocate](<https://devfeed.tech/sources/sid-patil-android-engineer-and-kotlin-advocate.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Compose](<https://devfeed.tech/topics/compose.md>), [Jetpack Compose](<https://devfeed.tech/topics/jetpack-compose.md>), [Android](<https://devfeed.tech/topics/android.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [compose](<https://devfeed.tech/tags/compose.md>), [compositional-patterns](<https://devfeed.tech/tags/compositional-patterns.md>), [extension-function](<https://devfeed.tech/tags/extension-function.md>), [functional-chaining](<https://devfeed.tech/tags/functional-chaining.md>), [higher-order-logic-kotlin](<https://devfeed.tech/tags/higher-order-logic-kotlin.md>), [inheritance-vs-composition](<https://devfeed.tech/tags/inheritance-vs-composition.md>), [jetpack-compose](<https://devfeed.tech/tags/jetpack-compose.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-articles-by-sid-patil](<https://devfeed.tech/tags/kotlin-articles-by-sid-patil.md>), [kotlin-fold-and-reduce-functions](<https://devfeed.tech/tags/kotlin-fold-and-reduce-functions.md>), [kotlin-functions](<https://devfeed.tech/tags/kotlin-functions.md>), [modifiers](<https://devfeed.tech/tags/modifiers.md>), [patterns](<https://devfeed.tech/tags/patterns.md>)

### AI overview

A Kotlin tutorial explains function chaining through compositional patterns and aggregation with fold functions. It uses Jetpack Compose's Modifier system on Android as a reference and demonstrates how to build a similar chaining system.

### Source excerpt

Leverage Kotlin fold aggregating operators to build function chains with compositional patterns. Learn how you can build a system similar to compose UIs Modifier logic on Android

## Effective Kotlin Item 46: Avoid member extensions

DevFeed: [Effective Kotlin Item 46: Avoid member extensions](<https://devfeed.tech/articles/effective-kotlin-item-46-avoid-member-extensions-39283.md>)

Original publisher: [Read original article](<https://kt.academy/article/ek-member-extensions>)

Published: 2021-07-18T00:00:00Z

Content type: tutorial

Language: en

Sources: [Kt. Academy](<https://devfeed.tech/sources/kt-academy.md>)

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

Tags: [dsls](<https://devfeed.tech/tags/dsls.md>), [extension-function](<https://devfeed.tech/tags/extension-function.md>), [function](<https://devfeed.tech/tags/function.md>), [integration-test](<https://devfeed.tech/tags/integration-test.md>), [interface](<https://devfeed.tech/tags/interface.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [visibility-modifier](<https://devfeed.tech/tags/visibility-modifier.md>), [workshop-learning-programming](<https://devfeed.tech/tags/workshop-learning-programming.md>)

### AI overview

This article explains how Kotlin member extension functions work and why they are generally discouraged. It recommends controlling visibility with visibility modifiers and identifies DSL builders, scope-related functions, and some integration test patterns as appropriate exceptions.

### Source excerpt

What member extensions are, how they are possible and why we should avoid using them.

## Android Vitals - First draw time 👩🎨

DevFeed: [Android Vitals - First draw time 👩🎨](<https://devfeed.tech/articles/android-vitals-first-draw-time-25854.md>)

Original publisher: [Read original article](<https://dev.to/pyricau/android-vitals-first-draw-time-m1d>)

Author: Py ⚔

Published: 2020-08-29T11:51:28Z

Content type: tutorial

Language: en

Sources: [Py ⚔](<https://devfeed.tech/sources/py.md>)

Topics: [Android](<https://devfeed.tech/topics/android.md>), [Monitoring](<https://devfeed.tech/topics/monitoring.md>), [App](<https://devfeed.tech/topics/app.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [bug](<https://devfeed.tech/tags/bug.md>), [callback](<https://devfeed.tech/tags/callback.md>), [coding](<https://devfeed.tech/tags/coding.md>), [community](<https://devfeed.tech/tags/community.md>), [development](<https://devfeed.tech/tags/development.md>), [engineering](<https://devfeed.tech/tags/engineering.md>), [extension-function](<https://devfeed.tech/tags/extension-function.md>), [function](<https://devfeed.tech/tags/function.md>), [inclusive](<https://devfeed.tech/tags/inclusive.md>), [monitoring](<https://devfeed.tech/tags/monitoring.md>), [performance](<https://devfeed.tech/tags/performance.md>), [performance-monitoring](<https://devfeed.tech/tags/performance-monitoring.md>), [software](<https://devfeed.tech/tags/software.md>), [vitals](<https://devfeed.tech/tags/vitals.md>)

### AI overview

This article explains how Android app startup time is tied to the first completely loaded frame and focuses on measuring when cold start ends. It compares Choreographer.postFrameCallback() with ViewTreeObserver.addOnDrawListener(), describing timing behavior, an API 25 issue, and an API 26 listener-merging bug workaround.

### Source excerpt

Header image: Light Field by Romain Guy. This blog series is focused on stability and performance monitoring of Android apps in production. Last week, I wrote about how to best determine the app start time. Today, we focus on determining the time at which cold start ends. According to the Play Console documentation: Startup times are tracked when the app's first frame completely loads. We learn a bit more from the App startup cold time documentation: Once the app process has completed the first draw, the system process swaps out the currently displayed background window, replacing it with the main activity. At this point, the user can start using the app. In Android Vitals - Rising to the first drawn surface 🤽♂, we learnt that: ActivityThread.handleResumeActivity() schedules the first frame. On the first frame Choreographer.doFrame() calls ViewRootImpl.doTraversal() which performs a measure pass, a layout pass, and finally the first draw pass on the view hierarchy. First frame Since API level 16, Android provides a simple API to schedule a callback when the next frame happens: Choreographer.postFrameCallback(). class MyApp : Application() { var firstFrameDoneMs: Long = 0 override fun onCreate() { super.onCreate() Choreographer.getInstance().postFrameCallback { firstFrameDoneMs = SystemClock.uptimeMillis() } } } Unfortunately, calling Choreographer.postFrameCallback() has the side effect of scheduling a frame that runs before the first traversal is scheduled. So the time reported here is before the time of the frame that runs the first draw. I was able to reproduce this on API 25 but also noticed it doesn't happen in API 30, so this bug was probably fixed. First draw ViewTreeObserver On Android, each view hierarchy has a ViewTreeObserver which can hold callbacks for global events such as layout or draw. ViewTreeObserver.addOnDrawListener() We can call ViewTreeObserver.addOnDrawListener() to register a draw listener: view.viewTreeObserver.addOnDrawListener { // repo

## Reified Type Parameter

DevFeed: [Reified Type Parameter](<https://devfeed.tech/articles/reified-type-parameter-25021.md>)

Original publisher: [Read original article](<https://typealias.com/concepts/reified-type-parameter/>)

Author: author@typealias.com (Dave Leeds)

Published: 2017-10-07T03:42:19Z

Content type: tutorial

Language: en

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

Topics: [Code](<https://devfeed.tech/topics/code.md>)

Tags: [cast](<https://devfeed.tech/tags/cast.md>), [class](<https://devfeed.tech/tags/class.md>), [code](<https://devfeed.tech/tags/code.md>), [examples](<https://devfeed.tech/tags/examples.md>), [extension-function](<https://devfeed.tech/tags/extension-function.md>), [function](<https://devfeed.tech/tags/function.md>), [generic](<https://devfeed.tech/tags/generic.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [programming](<https://devfeed.tech/tags/programming.md>), [property](<https://devfeed.tech/tags/property.md>), [reification](<https://devfeed.tech/tags/reification.md>), [reified-type-parameter](<https://devfeed.tech/tags/reified-type-parameter.md>), [type-parameter](<https://devfeed.tech/tags/type-parameter.md>), [types](<https://devfeed.tech/tags/types.md>), [variance](<https://devfeed.tech/tags/variance.md>)

### AI overview

An explanation of reified type parameters, including how they preserve type information in inline functions, support type checks and casts, and can provide class objects. The article covers single and multiple parameters, extension properties, requirements, alternatives, and code-size considerations.

### Source excerpt

Reified type parameters are type parameters that retain more characteristics of actual types than normal type parameters do. For a gentle introduction to the topic, check out the guide, Getting Real with Reified Type Parameters. Examples Single Parameter inline fun <reified T> Any.isInstanceOf(): Boolean = this is T Here we created an extension function to wrap the more common is operator. Why is this example so magical? Because normally, compiling this is T would result in an error since the type of T is erased.

## Choosing between with() and run()

DevFeed: [Choosing between with() and run()](<https://devfeed.tech/articles/choosing-between-with-and-run-25032.md>)

Original publisher: [Read original article](<https://typealias.com/guides/choosing-between-with-and-run/>)

Author: author@typealias.com (Dave Leeds)

Published: 2017-09-14T01:23:30Z

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>), [context](<https://devfeed.tech/topics/context.md>)

Tags: [comparison](<https://devfeed.tech/tags/comparison.md>), [extension-function](<https://devfeed.tech/tags/extension-function.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [programming](<https://devfeed.tech/tags/programming.md>), [readability](<https://devfeed.tech/tags/readability.md>), [run](<https://devfeed.tech/tags/run.md>), [safe-call-operator](<https://devfeed.tech/tags/safe-call-operator.md>), [scope-functions](<https://devfeed.tech/tags/scope-functions.md>), [standard-library](<https://devfeed.tech/tags/standard-library.md>)

### AI overview

This Kotlin tutorial compares with() and run(), explaining that they are nearly identical in compiled behavior and differ mainly in syntax. It highlights the extension-function advantage of safe-call handling for nullable receivers and discusses readability trade-offs.

### Source excerpt

In Kotlin's standard library, the Standard.kt file contains a number of scope functions that put a receiver object into a new scope as either this or as an argument (e.g., it). The with() function tends to be a bit of an outlier. The others are all extension functions, so they're invoked on an object. with(), on the other hand, takes its receiver (the object that it's operating upon) as an argument.

## Understanding Kotlin's let(), also(), run(), and apply()

DevFeed: [Understanding Kotlin's let(), also(), run(), and apply()](<https://devfeed.tech/articles/understanding-kotlin-s-let-also-run-and-apply-25044.md>)

Original publisher: [Read original article](<https://typealias.com/guides/understanding-let-also-run-apply/>)

Author: author@typealias.com (Dave Leeds)

Published: 2017-09-08T00:00:00Z

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>), [Programming](<https://devfeed.tech/topics/programming.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](<https://devfeed.tech/tags/function.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [programming](<https://devfeed.tech/tags/programming.md>), [scope-functions](<https://devfeed.tech/tags/scope-functions.md>), [standard-library](<https://devfeed.tech/tags/standard-library.md>)

### AI overview

A guide to Kotlin's let(), also(), run(), and apply() scope functions. It explains their shared characteristics and distinguishes them by code-block context and return value.

### Source excerpt

Kotlin's standard library includes some often-used scope functions that are so abstract that even those who have been programming in Kotlin for a while can have a hard time keeping them straight. In this guide, we're going to clarify four of these scope functions in particular - let(), also(), run(), and apply(). By the end of this guide, you'll have a framework for understanding them and should have a good idea of which one is most applicable in different scenarios.

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

## also() (scope function)

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

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

Author: author@typealias.com (Dave Leeds)

Published: 2017-09-04T19:41:30Z

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

Tags: [also](<https://devfeed.tech/tags/also.md>), [extension-function](<https://devfeed.tech/tags/extension-function.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [programming](<https://devfeed.tech/tags/programming.md>), [scope-function](<https://devfeed.tech/tags/scope-function.md>), [scope-functions](<https://devfeed.tech/tags/scope-functions.md>)

### AI overview

A Kotlin tutorial explaining the also() scope function. It shows that also() exposes the receiver as the lambda argument, conventionally named it, and returns the receiver object.

### Source excerpt

Overview The also() function is a scope function that was introduced in Kotlin 1.1. Example val size = "Hello".also { println(it) }.length In this example, the string "Hello" is printed, and then its length is assigned to the size variable. Characteristics When the also() extension function executes: the receiver object that .also() is called upon is available as the lambda argument - by default, named it the result will be the receiver object Create, Pass, and Evaluate A prime use case for also() is the pattern where you need to pass an empty object to another function for initialization.

## run() with receiver (scope function)

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

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

Author: author@typealias.com (Dave Leeds)

Published: 2017-09-03T20:04:25Z

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>), [Programming](<https://devfeed.tech/topics/programming.md>), [Library](<https://devfeed.tech/topics/library.md>)

Tags: [extension-function](<https://devfeed.tech/tags/extension-function.md>), [function](<https://devfeed.tech/tags/function.md>), [http](<https://devfeed.tech/tags/http.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [library](<https://devfeed.tech/tags/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>)

### AI overview

This tutorial explains Kotlin's run() extension function, one of the scope functions in the Kotlin standard library. It covers the receiver object, the function's result, and using run() to initialize and execute an object, including an HTTP client example.

### Source excerpt

Overview There are two different run() functions defined in Standard.kt in the Kotlin standard library, among a handful of scope functions that are frequently used in Kotlin programming. This article describes the one that's an extension function. Example val size = "Hello".run { println(this) this.length } In this example, the string "Hello" is printed, and then its length is assigned to the size variable. Characteristics When the run() extension function executes:

## Java Optionals and Kotlin Nulls

DevFeed: [Java Optionals and Kotlin Nulls](<https://devfeed.tech/articles/java-optionals-and-kotlin-nulls-25040.md>)

Original publisher: [Read original article](<https://typealias.com/guides/java-optionals-and-kotlin-nulls/>)

Author: author@typealias.com (Dave Leeds)

Published: 2017-09-01T00:00:00Z

Content type: tutorial

Language: en

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

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

Tags: [exception](<https://devfeed.tech/tags/exception.md>), [extension-function](<https://devfeed.tech/tags/extension-function.md>), [filter](<https://devfeed.tech/tags/filter.md>), [java](<https://devfeed.tech/tags/java.md>), [java-8](<https://devfeed.tech/tags/java-8.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [migration-guide](<https://devfeed.tech/tags/migration-guide.md>), [null](<https://devfeed.tech/tags/null.md>), [null-safety](<https://devfeed.tech/tags/null-safety.md>), [optional](<https://devfeed.tech/tags/optional.md>), [programming](<https://devfeed.tech/tags/programming.md>), [safe-call-operator](<https://devfeed.tech/tags/safe-call-operator.md>), [standard-library](<https://devfeed.tech/tags/standard-library.md>), [transformation](<https://devfeed.tech/tags/transformation.md>)

### AI overview

A guide to translating Java Optional usage into idiomatic Kotlin null-safety patterns. It compares creation, transformation, filtering, and conditional operations, while noting trade-offs and cases where Kotlin nullable types replace Optional.

### Source excerpt

When Java 8 introduced Streams for operating on collections of data, it also introduced a similar concept, Optional, which has many methods that are similar to Stream, but operates on a single value that might or might not be present. As you migrate your projects from Java to Kotlin, you might come across some Optional objects. What should you do? Should you leave them as Optional, or change them to more idiomatic Kotlin?

[Next page](<https://devfeed.tech/tags/extension-function.md?cursor=WyIyMDE3LTA5LTAxVDAwOjAwOjAwKzAwOjAwIiwgImVmN2EwOGEzLWU5YTktNGNmYy05Mzc3LTVhODY0OTRjZDg5ZiJd>)