nus-cs2030 / 2021-s1

27 stars 48 forks source link

Lab 8 Level 4 #582

Open frisciliasultan opened 3 years ago

frisciliasultan commented 3 years ago

Description

Describe the question
I don't understand why my main is still taking 20-30s, even though I join() outside the while loop. Does anyone know what is wrong with my code? Any help would be greatly appreciated! Screenshot 2020-11-30 at 10 31 27 PM

jiayi-lim commented 3 years ago

I think there is no need to make cf using the supplyAsync and thenCombine. You can just make a cf when you run BusSg.findBusServicesBetween(srcId, searchString).

frisciliasultan commented 3 years ago

Sorry, I'm still a bit lost. If I make cf inside the while loop, how do i collect them so that I can call the join?