Casting a list of concrete objects to abstract types

mateorey

New Member
This has been asked before here, but the solution is showing a warning saying "Unchecked cast". Is there a safer way to do this. Code is given below.\[code\]public abstract class Animal {...public class Dog extends Animal{.. public Vector<Animal> myFunc(String[] args) { // TODO Auto-generated method stub Vector<Dog> arVector = new Vector<Dog>(); return (Vector<Animal>)(List<?>) arVector; }\[/code\]
 
Top