Skip to content
0:00 / 0:00

#kotlin#kotlinflows#coroutines

Kotlin Tutorial - Kotlin at Light Speed, Part 5 - Functional Programming in Kotlin

Rock the JVM

27K subscribers • 62 videos on Hallway

YouTube
  • Recommended by 1 person: 1 in engineering communities.

Intermediate. Assumes working knowledge.

4K views2 years ago1 recommendation

Programming languagesDistributed systemsFunctional programmingConcurrency and parallelismKafka and stream processing

A practical tutorial on Kotlin Flows, covering how to build, manage, transform, and handle errors in asynchronous, non-blocking data streams.

blog post: blog.rockthejvm.com/kotlin-flows Complete Kotlin course: rockthejvm.com/p/kotlin-essentials This is a long-form practical introduction to Kotlin Flows, a reactive data structure that can emit values in an asynchronous, non-blocking fashion. This video will teach you how to build Kotlin Flows, how to manage their lifecycle, what to do in case your flows get empty or throw errors, how to transform Kotlin Flows with functional programming and more. You will also learn how Flows give you a high degree of control over how coroutines evaluate and process their elements, and finally we will explore primitives for merging, concatenating and otherwise concurrently transform multiple flows as our application becomes more complex. Timeline: Intro Building Flows Flow Lifecycle Error Handling and Retries Transforming Flows Flows and Coroutines Merging and Concurrent Transformers -------------------------------------------------------------------------- STARTER CODE -------------------------------------------------------------------------- ``` @JvmInline value class Id(val id: Int) @JvmInline value class FirstName(val value: String) @JvmInline value class LastName(val value: String) data class Actor(val id: Id, val firstName: FirstName, val lastName: LastName) { fun fullName() = firstName.value + " " + lastName.value } val henryCavill = Actor(Id(1), FirstName("Henry"), LastName("Cavill")) val galGadot: Actor = Actor(Id(1), FirstName("Gal"), LastName("Gadot")) val ezraMiller: Actor = Actor(Id(2), FirstName("Ezra"), LastName("Miller")) val rayFisher: Actor = Actor(Id(3), FirstName("Ray"), LastName("Fisher")) val benAffleck: Actor = Actor(Id(4), FirstName("Ben"), LastName("Affleck")) val jasonMomoa: Actor = Actor(Id(5), FirstName("Jason"), LastName("Momoa")) // The Avengers val robertDowneyJr: Actor = Actor(Id(6), FirstName("Robert"), LastName("Downey Jr.")) val chrisEvans: Actor = Actor(Id(7), FirstName("Chris"), LastName("Evans")) val markRuffalo: Actor = Actor(Id(8), FirstName("Mark"), LastName("Ruffalo")) val chrisHemsworth: Actor = Actor(Id(9), FirstName("Chris"), LastName("Hemsworth")) val scarlettJohansson: Actor = Actor(Id(10), FirstName("Scarlett"), LastName("Johansson")) val jeremyRenner: Actor = Actor(Id(11), FirstName("Jeremy"), LastName("Renner")) // Spider-Man val tomHolland: Actor = Actor(Id(12), FirstName("Tom"), LastName("Holland")) val tobeyMaguire: Actor = Actor(Id(13), FirstName("Tobey"), LastName("Maguire")) val andrewGarfield: Actor = Actor(Id(14), FirstName("Andrew"), LastName("Garfield")) ``` Follow Rock the JVM on: LinkedIn: linkedin.com/company/rockthejvm Twitter: twitter.com/rockthejvm Blog: Blog: blog.rockthejvm.com ------------------------------------------------------------------------- Home: rockthejvm.com -----------------------------

Why it's here

1 person recommends this

What people say. Recommended as an ultimate guide to understanding and using Kotlin Flows.

u/danielciocirlanin r/Kotlin • Recommends

Kotlin Flows - the Ultimate Guide