i have a class heirarchy,
Class b extends class a
Class c extends class a
All the three classes can be instantiated.
Now objects of these three types are added to a Set
.
I am required to traverse this set and find out the instances of type c and then do some processing on that.
Currently I am traversing the set and checking each entry if its a instanceof c .
Is there a better way of doing this?
Something in the Collections
library itself?