I have a Vector containing x. What is the most elegant way to get the values of the list as an Object[] and add an y element to the end of it?
x and y are not of the same class or so.
The obvious solution would be to make a new Object[] with the size of the Vector + 1. Then iterate over it and add each x, and then add y at the end.
Also,
Object[] objectArray = vector.toArray();
Would make the objectArray shrink by 1.
(If i understand right the Q …)