How to increase date when, endDate (date of arg[1]) is not in the JSON response (when NoSuchElementException is throwen)

I am in module 2 and getting successful input for endDate which is available in the JSON response, I gone through the forum and got to know that I need to increase the date so that it’s a working date and then print the output, I am weak in Java, so I’m finding it very difficult to execute it.
I know that “endDate.plusDays(1)” increases the date, I tried to implement it using do while loop. (to keep increasing the date until I hit a working day), but I’m getting stuck on various issues of endDate variable.
I’ve attached a screenshot showing the error.

and the below link of the similar article executing do-while loop with try catch block.
https://stackoverflow.com/questions/18838647/while-loop-with-exception-handling

Why can’t I increase the endDate??
PLEASE HELP AS I WANT TO GRADUATE AS SOON AS POSSIBLE (qmoney modules 2-5 are yet to be finished). OR CAN YOU PLEASE SHARE HINTS HOW TO EXECUTE THE INCREAMENT OF THE ENDDATE??

In module 2 as i remember, you just have to return the list of sorted stocks in ascending order of their closing price
Why do you have to increase the date ?

@Lavlesh, I’m finding match of the date which we pass in arg[1] with the JSON response, it is working as expected for working days(for arg[1] dates which are present in JSON response also), but in case, the arg[1] date is not a working day (in the case when the same date as arg[1] is not present in the JSON response), my code is returning an error: NoSuchElementException. So for that case I have to consider the date after the arg[1] date, so I have to increase the date which is used for comparison with the JSON response.

You just need the closing price and for that just select the last object from the collection of tingoCandles.

Can you refer to this FAQ
https://forum.crio.do/t/error-no-such-element-exception/10711/5

Closing this topic as there is no response since last 12 hours. Please feel free to create a new topic and post this question as a reference link in the description of the new topic.