I am using JComboBox with a custom class object, and the equals method is over-ridden, and integrated very deeply into the code.
The problem is that if two objects are equal in a JComboBox drop down, then if one is selected all are selected, and the get selected index returns -1.
Is there a ways to cast a Vector<ObjectA>
to a Vector<ObjectB>
?
I tried
Vector<Clas_2> v_temp=(ca.courses.get(i).classes);
and
Vector<Clas_3> v_temp=(ca.courses.get(i).classes);
Where Clas_2
is a parent of Clas_1
and Clas_3
is a extends of Clas_1
, but neither of them compile.
All i need is JComboBox not to use the over-ridden equals method.
*Note I know I can cast each individual element into a new array, but would rather have a more memory efficient solution.