nus-cs2103-AY2425S1 / forum

12 stars 0 forks source link

Implemented stream before this week's increment, can I simply tag that commit as A-Stream? Also, seeking more advices on use of streams #267

Closed MAOXIONGKAI closed 1 month ago

MAOXIONGKAI commented 1 month ago

Hello prof, I would like clarify if it is ok to tag a previous week's commit with current week's increment tag? Because I realize that my project actually has already implemented some methods with the help of Java stream which means my project technically fulfills the requirement specified by A-Stream, and I am not really sure where else I can actually implement stream within my program. Thank you.

Also, for others who are currently working on this week's tasks, what are your use of streams in your own program? For me, I have designed my delete task method to accept multiple task numbers as variable arguments, and since ArrayList will left shift all the objects after the deleted object after deletion, I have used stream to map the task numbers to corresponding tasks in the ArrayList and delete them by object reference instead of index(because left shifting of object will mess up the index of the rest of object, introducing error to the feature) to ensure the correct objects are deleted. Would appreciate if anyone can offer some hints on other possible usage of stream, so I can try make some new improvements instead of just tagging previous commit for this week task, thank you!

Feng1231 commented 1 month ago

Hi, I used stream for the on command

My on command search deadline and event tasks that happens on a given date I converted my tasklist to stream, and then filtered the stream using the provided methods in stream. Then for printing in this case, it could be done with forEach method in stream as well.

The usage was similar to what we did in cs2030s

damithc commented 1 month ago

Hello prof, I would like clarify if it is ok to tag a previous week's commit with current week's increment tag? Because I realize that my project actually has already implemented some methods with the help of Java stream which means my project technically fulfills the requirement specified by A-Stream, and I am not really sure where else I can actually implement stream within my program. Thank you.

@MAOXIONGKAI Yes you may tag past commits if an iP increment is already implemented in your code.

MAOXIONGKAI commented 1 month ago

@Feng1231 Hi! Thank you for your input! Appreciate on the ideas, I should have thought of using filter() method earlier haha, thanks for the help! @damithc Thank you prof for the clarification! I will leave this post open for a bit more time if anyone else would like to share on more interesting ideas on using streams. Thanks!

zaidansani commented 1 month ago

I think in general, you can just utilise streams for any list processing function? Filtering, listing.

If you look at this week's task with regards to BCDExtension a LOT of those extensions are implemented extremely easily with a stream IMO.

emmannyyy commented 1 month ago

I used streams for certain commands like the MarkCommand,UnmarkCommand and FindCommand. As other users have mentioned, I think streams can be used wherever there are Lists involved. In my opinion, they make the code a bit more readable. Also, I searched my repo to find code where there were for-loops used. For those, I converted it to streams to increase safety. Curious also to see how others have used this!

nus-se-bot commented 1 month ago

@MAOXIONGKAI A gentle reminder to close this issue if the problem has been resolved. If not resolved yet, please post a comment explaining which part of the problem/question remains unresolved.