randomJumpResultsInBadPerformance() fails in assessment

after going through all discussion and implementing all possible optimization getting this error

Hey can you please try to follow up with the instructions given in this FAQ -

yes i have already read and tried those but still it fails. can you please check my code and give some hints

Hey, I have checked your code and your build is passing locally, can you please confirm have you added the 2 lines in the build.gradle file
testLogging.events (“standard_error”);
testLogging.events (“standard_out”)

These will give you the time taken for the tests to run. We are fairly certain that there is some issue with your optimisation. And that you have to figure out as a part of this module.

Yes I have added these two lines

Yes, you have to optimize these on your own, think about why these are failing.
Have you used an additional variable anywhere?

Hey ,
You can use the steam api in the constructor it works much faster.
Hint credit @dotslash21
Good Luck

Hey could you explain it more ?
Any link ?

I meant stream API sorry for the typo

check this

https://thecodinginterface.com/blog/java-collections-stream-cloning/
I referred this link. Just see where and how the arraylist list is declared and edit the stream code according to our code.

Try making a new FileInfo object in constructors of implementations of SourceFileVersion.

Also, try to use the given copy constructors in the stubs, for the purpose of cloning, instead of making a new clone method.

Hope this helps.

Closing this topic as your issue has been resolved by the community. If not Kindly un-mark the accepted solution to re-open the topic or feel free to create a new topic and post a link to this topic as a reference.