Finding an object of given properties in an ArrayList
if I have an array list of objects GRects for example. that are filled different colours.
can i search the ArrayList to discover if there are GRects in the array list that have a getFillColor() == RED
or better still i'd have a Boolean method that when passed a colour will return true if there is a red GRect in the arraylist
looking at the documentation i cant see how the contains method will do this.
perhaps i'm missing something interpreting how the syntax works? or im looking at the wrong method?
I'm playing with a breakout game
if all the RED GRects have gone from the arrayList I want to do something.
my alternative approach would be to have an arraylist for each color of GRects. because it's easy to determine if the Arraylist is empty.
but that would involve checking if five arraylist instead of one. and i prefer to keep the GRects in one ArrayList if its possible.
thanks in advance