Searchable List Structure?
I've hit a bit of a snag again. This time I'm just not sure what kind of a structure I need to accomplish what I want to do, and I'm hoping you can help me. I don't mind researching how to use it, but I'm not really sure what I'm looking for.
Basically I want something like a searchable list. It will act like a database within my program (without actually having to use a database, as right now I'm just learning and I'm desperately trying not to overcomplicate things lol).
Example: If I created a circle class, and created 4 circle objects. Each circle object has a color attribute, and all four circles are different colors.
I want to have a dynamic list of circle objects that will allow me to find a specific circle object by it's color. So if I wanted to see if the list contained a blue circle, I would search the list for a circle that had it's color attribute set to blue. In keeping with encapsulation, the color attribute would be private, and I would need to use public accessor methods to check if any of the circles are blue, and return the index of the circle that matches my query, or null/0/whatever if none matched the query.
Is there such a structure? I've only really played with ArrayList up to this point, but if there is another that would be better suited to what I need I would love to know about it :)
If my explanation is unclear, or if you simply need to know specifically what I need to use this for, I'll be happy to explain further.
As always, I thank you very much for your time, understanding, and patience!