5 Fatal Coroutine Mistakes Nobody Tells You About

Sdílet
Vložit
  • čas přidán 28. 06. 2024
  • Coroutines are the preferred option for asynchronous programming in Kotlin if you ask me. Still, you need to know what you're doing, else it can quickly backfire for you.
    This video shows you 5 common mistakes you rarely hear about when it comes to using coroutines.
    ⭐ Get certificates for your future job
    ⭐ Save countless hours of time
    ⭐ 100% money back guarantee for 30 days
    ⭐ Become a professional Android developer now:
    pl-coding.com/premium-courses...
    💻 Let me personally review your code and provide individual feedback, so it won't backfire and cost you a fortune in future:
    elopage.com/s/philipplackner/...
    Subscribe to my FREE newsletter for regular Android, Kotlin & Architecture advice!
    pl-coding.com/newsletter
    Join this channel to get access to perks:
    / @philipplackner
    Regular live codings on Twitch:
    / philipplackner
    Join my Discord server:
    / discord
    Regular programming advice on my Instagram page: / _philipplackner_
    Checkout my GitHub: github.com/philipplackner
    You like my free content? Here you can buy me a coffee:
    www.buymeacoffee.com/philippl...
    00:00 - Introduction
    00:40 - Mistake 1
    05:51 - Mistake 2
    08:26 - Mistake 3
    11:11 - Mistake 4
    14:26 - Mistake 5

Komentáře • 180

  • @marksunghunpark
    @marksunghunpark Před 2 lety +90

    It's parellel dispatch and you can even use it for async mapper. You can make the code shorter if you want:
    val firstNames = userIds.map { userId ->
    async { getFirstName(userId) }
    }.awaitAll()

    • @pradiptapriya7546
      @pradiptapriya7546 Před 2 lety +5

      Hi, do you mind answering some of my questions regarding this async? When using async and awaitAll() to get data, is there a chance that the order of name lists retrieved will be changing every time the operation is done? Because I thought since it's being done parallel, there's a time when some data in API are obtained faster than others, making the order of the list changing every time based on how the network performance is right? Or the list will be always the same?

    • @marksunghunpark
      @marksunghunpark Před 2 lety +5

      @@pradiptapriya7546 It's same with
      async { getFirstName(userIds[0]) } +
      async { getFirstName(userIds[1]) } +
      async { getFirstName(userIds[2]) }...
      So, it should be the same order.

    • @pradiptapriya7546
      @pradiptapriya7546 Před 2 lety +1

      @@marksunghunpark I see! Thank you very much! With this, I can improve my code a bit!

    • @dev_jeongdaeri
      @dev_jeongdaeri Před 2 lety

      Async mapper 엄청나네요!! 감사합니다!!👍👍👍👍

    • @phantuananh2163
      @phantuananh2163 Před 2 lety

      Dope 😍

  • @SamRamezanli
    @SamRamezanli Před 2 lety +53

    I don't know how to express how helpful this video was.
    blogs and tutorials often tell us what to do, but it's important to understand what not to do as well.
    Looking forward to more videos like this

  • @codinginflow
    @codinginflow Před 2 lety +23

    This changes everything!

    • @RanbirSingh-dl9co
      @RanbirSingh-dl9co Před 2 lety

      Above dialogue is said by Bulma from Dragon ball Super when Goku arrive when frizza attacked earth.

  • @it-6411
    @it-6411 Před 2 lety +34

    Pay attention, that when you use .awaitAll() function in the list of deferred items and if any of these will throw exception, you'll get exception for the whole operation. So, you should use .awaitAll() only in case, when you except full success of all async calls. In other case to handle exceptions for specific items, you can use list.map { it.await() } and try/catch block.

    • @PhilippLackner
      @PhilippLackner  Před 2 lety +5

      Correct, thanks for mentioning :)

    • @it-6411
      @it-6411 Před 2 lety

      @@PhilippLackner you’re welcome)

    • @abdremo
      @abdremo Před 2 lety

      OK🤙

    • @ChrisAthanas
      @ChrisAthanas Před rokem

      Like this?
      suspend fun getUserFirstNames(userIds: List): List {
      // Alternative solution - executed in parallel, but allows for each item to cause exception
      val firstNames4 =
      coroutineScope {
      userIds.map { userId ->
      async {
      try {
      getFirstNameWithExceptions(userId + 1000)
      } catch (e: Exception) {
      println("Exception in getUserFirstNames: $e")
      "Error for id=${userId+1000}: $e"
      }
      }.also {
      }
      }
      }.also {
      }.awaitAll()
      return firstNames4
      }
      suspend fun getFirstNameWithExceptions(userId: Int): String {
      delay(500)
      println("getFirstName: $userId")
      if (userId > 1005) { // simulate an error
      throw Exception("userId > 505")
      }
      return "John $userId"
      }
      // note: I am using the `.also{}` blocks in order to let the IDE show the type at that point in execution

    • @suleyman_sezer
      @suleyman_sezer Před měsícem

      thank you for your correctly idea.

  • @pizzapizzadesu
    @pizzapizzadesu Před 2 lety +8

    great timing. i was just about to make the "mistake 1" one for retrieving images. Really appreciated

  • @-Kimma-
    @-Kimma- Před 2 lety +5

    This is so good and clear!
    This also explains some minor issues I have to understand some of the functionality with coroutines.
    I'm going to use this video as code snippets when coding my coroutines 😀

  • @LogicPhalanx
    @LogicPhalanx Před 2 lety +2

    Mistake 3 is actually main safe but I get your point. Delay doesn't block the calling thread.

  • @Shasha-zs4dx
    @Shasha-zs4dx Před rokem

    Kudos to you for making this video...Learned very tricky points related to coroutines by watching this..Thank you mate.keep making these awesome videos

  • @anupdey99
    @anupdey99 Před 2 lety

    Excellent content as always! Please make a series about those mistakes. Appreciate your hard work. 🙌

  • @skandarsouissi7282
    @skandarsouissi7282 Před 2 měsíci

    i'm addicted to your videos man, i can't sleep.

  • @adamjacob5482
    @adamjacob5482 Před 2 lety

    Love your videos, love your work. Always great content! Thank you very much :)

  • @yash1307
    @yash1307 Před 2 lety +27

    Sir why are you not becoming a Google Developer Expert? Because you provide an amazing and helpful content...

  • @spitze3768
    @spitze3768 Před 2 lety

    Great videos! They are very informative and have help me a lot in my shift to kotlin. Keep up to good work!

  • @jose-naves
    @jose-naves Před 2 lety +1

    Pure gold. Thanks a lot!

  • @behnawm
    @behnawm Před 2 lety

    Great stuff Philipp! Keep it up!

  • @hakimbouatou2558
    @hakimbouatou2558 Před 2 lety

    Amazing content as always!

  • @a.rohimsama7222
    @a.rohimsama7222 Před 5 měsíci

    Thank you for sharing! super helpful! love it!

  • @Ayor88
    @Ayor88 Před 2 měsíci

    as always with your videos, very interesting for self learners !

  • @TiagoDvl
    @TiagoDvl Před 2 lety

    Really nice model of videos. Keep up, man.

  • @asadnaqvi8901
    @asadnaqvi8901 Před 2 lety +1

    The content you are providing is not available on highly paid sites. You are doing great work. Keep it up buddy 🎉🎉

  • @Lucien-ow5ne
    @Lucien-ow5ne Před měsícem

    Great video, thank you!

  • @dev_jeongdaeri
    @dev_jeongdaeri Před 2 lety

    Thanks for super awesome tutorial!!👍👍👍👍❤️

  • @sohaybbahi8983
    @sohaybbahi8983 Před 2 lety

    Great video, keep on creating great content !

  • @stanleykou5643
    @stanleykou5643 Před 2 lety

    Excellent examples!

  • @user-me1ry6lg6d
    @user-me1ry6lg6d Před 4 měsíci

    what an explanation Philip . You earned a like .

  • @IvanVasheka
    @IvanVasheka Před 2 lety

    Thanks for the video!

  • @RexTorres
    @RexTorres Před 2 lety

    Thanks for this awesome video. I learned A LOT. I use coroutines a lot so I will need to review those.

  • @dedeandres455
    @dedeandres455 Před 2 lety

    amazing video and good explaination
    Thanks Philipp

  • @gaurav7557
    @gaurav7557 Před 2 lety

    Awesome Man, Thanks a ton for this

  • @z-h-d
    @z-h-d Před 2 lety

    nice video to watch before sleep ) easy listening, very clear and positive 👍

  • @imashnake_7151
    @imashnake_7151 Před 2 lety

    Wow you look so much healthier now, great work!

  • @GeolseuDeiGamers
    @GeolseuDeiGamers Před 2 lety

    Thank you so much, your videos are awesome

  • @cristianovecchi
    @cristianovecchi Před 2 lety

    Great content, thanks!

  • @rahul_spawar
    @rahul_spawar Před 2 lety

    This video is very helpful , please make more videos like this

  • @shutanovac
    @shutanovac Před 2 lety

    Your best video as far as I'm concerned 👍

  • @usmallas2
    @usmallas2 Před 2 lety

    We need more videos like this one!

  • @user-us3pn5rt2g
    @user-us3pn5rt2g Před 2 lety

    Can you please, make several hours of such kind examples) so amazing stuff

  • @saquibsiddique2641
    @saquibsiddique2641 Před 2 lety

    Really very helpful thanks for sharing @Philipp

  • @datel666
    @datel666 Před 2 lety

    Nice video! Thanks

  • @sergeyplotnikov5031
    @sergeyplotnikov5031 Před 2 lety

    Really useful content/ Thank you very much!!!

  • @MrGfpf
    @MrGfpf Před 2 lety

    Great tips! Thanks in advance! Brazil!

  • @chandlerbing2820
    @chandlerbing2820 Před 2 lety

    Love all your videos. Please do more Android studio projects. Thank you so much!!!!!!!

  • @arash1684
    @arash1684 Před 2 lety

    very useful thanks 👍

  • @safionweb
    @safionweb Před 2 lety

    Amazing Content!

  • @nickolajarjous2639
    @nickolajarjous2639 Před 2 lety

    Excellent video

  • @thanosfisherman
    @thanosfisherman Před 2 lety +2

    Mistake 4. If you make this suspending function return coroutineScope ( The suspend function you also used for mistake 2) or even withContext. Then the cancellation exception will be actually propagated to the outer scopes even if you explicitly catch in inside riskyTask e.g suspend fun riskyTask() = withContext() {}

  • @bjugdbjk
    @bjugdbjk Před 2 lety +1

    Even without async just with the launch, we can have parallel execution because both are non-suspending calls !! Async is specifically useful when you want to get something out from a coroutine !!

  • @mustafaammar551
    @mustafaammar551 Před 2 lety

    Thank you Bro

  • @ramasubramanian3154
    @ramasubramanian3154 Před 2 lety +1

    please make this a weekly video series.🙏

  • @amirhosseinghafoorian9985

    nice issues were mentioned here , especially the defered one

  • @solo-ps9vb
    @solo-ps9vb Před 2 lety

    Very helpful. Using coroutines means coding in a new way.

  • @joaquinalanalvidrezsoto5054

    Sehr tolles Video. You should make more like this :D

  • @ssgojekblue
    @ssgojekblue Před 2 lety +1

    I'm refactoring all my Mistake 5 now 😃

  • @otoS97
    @otoS97 Před 2 lety +2

    Amazing video.I would love more of videos like this. It tests the knowledge and also reminds you details.
    Really good content.

  • @ByronicGuitarist
    @ByronicGuitarist Před 3 měsíci

    Great video. Rather than checking if an exception is a CancellationException in a try-catch block, you could use runCatching instead which does not catch CancellationExceptions

  • @antonychepel5797
    @antonychepel5797 Před 2 lety

    Thanks for video! So usefull. What is that IDE? Visual Code or something else?

  • @TheKuoala
    @TheKuoala Před 9 měsíci

    One thing worth mentioning for Mistake1 is the fact that coroutineScope will suspend until all the async calls finish. Therefore reading the result code like this could be confusing since you aren't really waiting for anything outside of the coroutineScope block.

  • @HosseinKurd
    @HosseinKurd Před rokem

    Amazing and useful

  • @christianmeazza2309
    @christianmeazza2309 Před 2 lety +1

    I'm glad you're here to tell me about those mistakes, you are the best. I see the next video coming: "5 Fatal Kotlin Flows Mistakes Nobody Tells You About" :D

  • @dk6024
    @dk6024 Před 2 lety +1

    In the first example, you could have mapped over the incoming IDs and avoided some code and mutability.

  • @zekininadresi
    @zekininadresi Před rokem

    I think using launch would be better as async would bring all parent the scope down if once job fails to retrieve the name (unless it's supervised).

  • @thegreatwarrior4989
    @thegreatwarrior4989 Před 2 lety

    Very informative vedio👍👍😉😉😉

  • @otoS97
    @otoS97 Před 2 lety +1

    Everyone is providing video ideas so I would say it too:
    Running android Junit and Android tests on Gitlab's CI on every commit.
    If you're had any experience with this it would be a great video.
    Maybe with docker maybe without it.

  • @ChrisAthanas
    @ChrisAthanas Před rokem

    @PhilippLackner @17:36 you mention needing to cancel the long-living CoroutineScope, but did you mean any Jobs that were started with the long-living CoroutineScope, and not cancelling the CoroutineScope itself? I dont see any way to cancel the CoroutineScope, just jobs associated with the scope. Please advise.

  • @path_ethics
    @path_ethics Před 2 lety

    How to create and manage cancelation of our own scope, for example in case we want to have a scope binded to our whole application?

  • @user-ew8wc2mc1o
    @user-ew8wc2mc1o Před měsícem

    Hello, thanks for the amazing videos but one question always concerns me:
    isn't sometimes the overhead of creating a lot of coroutines defies the purpose of performing tasks in parallel? or wouldn't it be a problem?

  • @amnsatija
    @amnsatija Před 2 lety

    best corotuines video ever

  • @alishanvaliani9952
    @alishanvaliani9952 Před 2 lety

    Hi! Make video about Maps Compose, Please!

  • @crayolaksh
    @crayolaksh Před 2 lety

    Hi, mistake 2 can also be handled with a withTimeout block right? it'll throw an exception if the operation within takes longer than specified time. Please correct if I'm wrong

  • @l_a_h797
    @l_a_h797 Před 6 měsíci

    Very helpful explanations!
    At 4:07, with what keystrokes did you move the whole for loop up together? Ah, looks like Shift+Cmd+Up on Mac. Very useful!
    (Unfortunately, the video title is misleading clickbait. These are not mistakes that "nobody tells you about." Making your suspend functions main-safe, for example, is a principle thoroughly discussed in Android documentation about coroutines.)
    On mistake #5, the point is valid that the lifecycleScope is too short-lived for the purpose of posting data to an API, and using the viewModelScope is an improvement. But the ViewModel too can be destroyed (for example if the user navigates to another activity) while data is being posted to the API, and that is not what the user wants either. Android docs recommend that "business-oriented operations," such as uploading users' data, should survive even process death. For that, WorkManager is recommended.

  • @jpvs0101
    @jpvs0101 Před 2 lety

    Thanks for saved me from Mistake 5

  • @kemasdimas
    @kemasdimas Před 2 lety +2

    Wow thank you, didn't realize I made a lot of inefficient coroutine calls in my app! 😅 Does your paid course cover this extensively? Will need to check it out

    • @PhilippLackner
      @PhilippLackner  Před 2 lety +1

      My paid courses cover lots of topics and best practices in a bigger practical project 😄

    • @kemasdimas
      @kemasdimas Před 2 lety

      @@PhilippLackner bought it, thanks!

  • @psistarpsi80
    @psistarpsi80 Před 2 lety

    I wish you'd make a video like this for Lua. Lua coroutines continuously befuddled me.

  • @AdrianTache
    @AdrianTache Před 2 lety +1

    I think mistake 2 is misleading, because that code should be safe as written. But I agree, with components that aren't coroutine safe, like long running calculations, you should do a check before continuing them whenever it makes sense.

    • @johnf419
      @johnf419 Před 2 lety

      Agreed, I think the example was not realistic

  • @ivanstefanenko438
    @ivanstefanenko438 Před 2 lety

    Thanks for the videos, they are really awesome!
    One question about Mistake 2: what did you mean when said we will stay in while loop if will not check for is job active?
    Did you mean while loop will continue executing even after we cancel job?
    Probably I've caught smth wrong, so will appreciate it if you clarify this thing!

    • @PhilippLackner
      @PhilippLackner  Před 2 lety +1

      Yes it will go on after canceling

    • @DanieleSegato
      @DanieleSegato Před 2 lety +1

      That code is long running and has no suspended calls in the middle, it's regular code. Meaning it's your job to check.
      If you had the same loop with a suspending function to create a random you wouldn't need to check cause it would be checked automatically at the next suspending call.

    • @GakisStylianos
      @GakisStylianos Před 2 lety +3

      @@DanieleSegato actually having a suspend function doesn't automatically fix this. If that suspend function doesn't also cooperate with cancelation then it will still keep going on forever. All suspending functions inside kotlinx.coroutines do cooperate with cancellation but that may not be true for your own suspending functions!

    • @ivanstefanenko438
      @ivanstefanenko438 Před 2 lety

      Roger that! Thank you all for the answears!

  • @zeyadabdo1964
    @zeyadabdo1964 Před rokem

    Do I need to call suspend functions of Retrofit and Room on a background thread?

  • @chibuezefelixanyanwu300

    Can you please handle paginate data with retrofit

  • @purplehazer417
    @purplehazer417 Před 2 lety

    Hello from Poland:)

  • @silvestreramirez4515
    @silvestreramirez4515 Před 2 lety

    But for example if I have one thousand client IDs this works? Can I have one thousand async task at the same time running?

  • @aleksandr.liublinskii
    @aleksandr.liublinskii Před 2 měsíci

    In mistake #1 since we have multiple coroutines spawned by async, and they all access the mutableListOf concurrently, shouldn’t we use thread safe data structure, for example COW list instead?

  • @_checkit
    @_checkit Před rokem

    #5 so let's say that button is a "save and close" button for the current activity. What then?
    You pass the "finish()" method as callback to the viewmodel method?

  • @7xFuryPlayz
    @7xFuryPlayz Před rokem

    my question is ? will its good or bad to use repository class in the last mistake ? i think so viewModel should not interact with your api , repository class should interact with your api and give data to viewModel and then viewModel give data to activity or fragment ui right ???

  • @GrahamFirst
    @GrahamFirst Před rokem

    In mistake 3, shouldn't "networkCall" just return a string (or throw an exception)? I don't see the point of wrapping it in a Result in this case.

  • @Nekrull
    @Nekrull Před 2 lety

    You're right that suspend functions should not be exposed to the UI and I'm with you 200%, but have you seen Google's paging library? that thing not only uses suspend functions to submit data to the adapters, but it also seems to run load queries on the UI by passing the paging source to the list's adapter, it's actually the only library that I promised that I will never use

    • @PhilippLackner
      @PhilippLackner  Před 2 lety +1

      I don't like the paging library either, but the load queries are done in the viewmodel afaik

    • @Nekrull
      @Nekrull Před 2 lety

      @@PhilippLackner I will test it out but I don't think it does it on the view model, you post a paging source (which in effect is an object that contains suspending functions to load the data) to your paging adapter through the fragment or activity's lifecycle scope, so it's pretty much impossible to run something on viewmodelscope, though I guess you could create the adapter on viewmodel and let the observer attach it to the paged list, but adapters in the view model are a bitch to unit test without robolectric

  • @deepeshkumar1704
    @deepeshkumar1704 Před 2 měsíci

    Can i update UI like async(first) method?

  • @danyelsh874
    @danyelsh874 Před 2 lety

    Awesome

  • @aherbel
    @aherbel Před 2 lety +1

    For Mistake #1, doesn't creating a new coroutineScope inside a suspend function loose the parent scope? I mean, if some error is thrown inside that coroutineScope, the parent will not get cancelled...

    • @bobbybeat1
      @bobbybeat1 Před 2 lety

      The coroutineScope function creates a CoroutineScope that inherits the context of the parent and forwards cancellations/exceptions to the parent scope.
      More info: kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/coroutine-scope.html

  • @s-w
    @s-w Před 2 lety

    I see a Philipp Lackner video, I click.

  • @grimonce
    @grimonce Před 2 lety

    There's something weird with the first example...
    isn't appending to the list synchronous in here?
    Why didn't we include it in the async block?
    I don't know the first thing about Kotlin, I use different tools, but to me this didn't fix anything, unless using "coroutineScope" makes appending asynchronous somehow...
    Also won't adding the firstNames to the async block become a race condition?
    Is the memory reserved for the result ahead of time thanks to the type DeferredString?

  • @zanyking
    @zanyking Před 2 lety

    Be careful while using async in web backend development, if the function is going to be triggered by client request, and you expect high QPS on this function, then you have to create your own thread pool for this async to use
    Never use default thread pool, because it’s small and might exhausted and cause other client requests await

  • @ackerman6992
    @ackerman6992 Před 2 lety +4

    Why it necessary to call async function inside coroutine scope? 🤔 We can call a suspend function in other suspend function right? Or we call coroutine scope so that the function inside coroutine scope works independently?

    • @skullkrum20
      @skullkrum20 Před 2 lety

      Usually your coroutines code runs sequentially. We use async so that we can immediately loop and call async again for the new iteration. This way you start all jobs initially and then wait for all of them to finish with "awaitAll".

    • @ackerman6992
      @ackerman6992 Před 2 lety

      @@skullkrum20 yes i undestood that, but i was asking why we need to call async inside coroutine scope.

    • @skullkrum20
      @skullkrum20 Před 2 lety

      @@ackerman6992 Its for that reason. If you don't you will run everything sequentially. Usually you don't need to if you're fine with that.
      Good name btw, I'm in love by Shingeki no Kyogin. :D

    • @ackerman6992
      @ackerman6992 Před 2 lety

      @@skullkrum20 ohk got it, Thanks 😂

    • @bjugdbjk
      @bjugdbjk Před 2 lety

      @@ackerman6992 coroutinescope, in this context , this is required because u r launching the coroutines with async, and to control them u need coroutinescope here !! And inside a suspend function we can't launch a coroutine !!

  • @rustamibrahimli2113
    @rustamibrahimli2113 Před 2 lety

    Can you tell me please: What is your Color theme?
    This is such a beautiful theme

  • @MrBicelis
    @MrBicelis Před 2 lety

    What should I do if I want a suspend function in viewmodel (Room function to update entity) to finish the work even after viewmodel gets destroyed?

    • @PhilippLackner
      @PhilippLackner  Před 2 lety +1

      Use an application scope instead of viewmodelscope

    • @MrBicelis
      @MrBicelis Před 2 lety

      @@PhilippLackner thanks, Phillip! You mean you would launch such a coroutine with GlobalScope? I thought it's a bad practice to use it, so I was looking for ways to avoid it. Even looking into using WorkManager... 🙂
      For more context: my activity is used for reordering and/or adding items to a list, after user presses back/up button, I want to update the list in a Room database. I was using viewModelScope, but it wouldn't manage to save in time before the viewmodel gets destroyed.
      Btw, amazing content Phillip!

  • @StreetsOfBoston
    @StreetsOfBoston Před 2 lety

    Nice video!
    But Mistake #3 is not a mistake at all:
    The function "networkCall" *suspends* for 3 seconds. It does not *block* for 3 seconds. Since "networkCall" is not blocking, there is no need to fix it by using a "withContext".
    If you wrote/coded "Thread.sleep(3000L)" instead, then this example would have been a real mistake, since you could have *blocked* (not suspended) the main thread.

    • @etiennebeaulac8148
      @etiennebeaulac8148 Před 2 lety

      The issue is not that he thought it was blocking, but that the function was not main-safe, which is a mistake. Changing the context to Dispatchers.IO was the right thing to do. Of course, as he mentions, if you use Retrofit you don't need to worry about this since it does it for you.

    • @StreetsOfBoston
      @StreetsOfBoston Před 2 lety

      @@etiennebeaulac8148 If the "networkCall()"'s body contained "Thread.sleep(3000L)" (or has some actual blocking call like waiting for a socket), then switching the context to Dispatchers.IO would have made perfect sense
      Written as it is, the code in Mistake -#3, is entirely main safe, since there is no blocking code, only suspending code.
      Replacing 'delay' with 'Thread.sleep' will make it blocking and not main-safe.
      It's a bit of nit-picking, but I think details are important sometimes 🙂

  • @Monarch_943
    @Monarch_943 Před 2 lety

    Damn this was a very good video! it seems I'v been making alot of mistakes :/

  • @codingwithsam4992
    @codingwithsam4992 Před 2 lety

    Hey Phillip, Its Samuel Laskar again.
    Can you please share some ways to make money by developing android apps. As playstore is already very saturated and freelance sites pay very less

  • @samandar7632
    @samandar7632 Před 2 lety

    My Android Studio (Bumble bee); not implementing github dependencies! Who resolved this problem?

  • @abdullahejaz6571
    @abdullahejaz6571 Před 2 lety +1

    is not retrofit call main safe?

  • @JujareVinayak
    @JujareVinayak Před rokem

    13:23 ArithmeticException

    • @bro_chenzox
      @bro_chenzox Před 9 měsíci

      He did know, just "asked" for a comment

  • @armandoavila4615
    @armandoavila4615 Před 2 lety

    Great video, thank you! I have a question, in the firt example (about the Deferred first names), lets say there are 5 ids and you're expecting 5 names in return, if for some reason the first call takes a long of time and the second call finishes first that would affect the order of the returne first names or Deferred helps with that?

    • @ChrisAthanas
      @ChrisAthanas Před rokem

      AwaitAll collects the results as they come in, but keeps them in order. You can easily test this yourself but changing the delay in `getFirstName()` to be `delay(Random.nextLong(1000))` and see for yourself.