Java improvement query.

Java improvement query.

Hey guys! I began programming roughly two weeks in the past so I’m fairly a noob..

I’m at present studying Java and dealing on a small sport venture as a part of my journey to changing into a Java developer. In my sport, I’m implementing a Shop class that manages a group of Item objects (similar to CDs, vinyl records, and cassettes). I want so as to add and take away gadgets dynamically, and I’m making an attempt to observe good object-oriented design ideas.

My present method is utilizing an ArrayList<Item> to retailer the stock, with strategies like addItem(Item merchandise) and take awayItem(String title), the place I seek for an merchandise by title earlier than eradicating it. However, I’m questioning if that is the very best method.

Are there any greatest practices or various knowledge constructions I ought to take into account for managing stock effectively? Should I override equals() in my Item class for higher elimination dealing with? Also, how would you advocate dealing with instances the place an merchandise is not discovered within the stock?

I’d admire any steering on greatest practices and potential enhancements!

submitted by /u/Nando-1717
[link][comments]

Vinyl

by way of r/SoftwareEngineering https://ift.tt/ytkSdOn

February 19, 2025 at 04:41PM