I need to cast a collection of objects to a subclassed object, but continue to receive an ArrayStoreException.
For Example, the objects in the collection are all of a Dog type. I'd like to cast the complete collection to a subclass I created called Dalmation that extends Dog...
List c = new java.util.ArrayList();
//...add collection of 'Dog' objects to c -> c.addAll(...);
c.toArray (new Dalmation);
I thought this would work, however it doesn't.
What's the proper way to cast these objects in the collection?