Do I have to push my elements one by one? I tried something like
String[] array;
array=...
Vector vector = new Vector(array);
but my eclipse marks this as an error.
解决方案
Vector doesn't have a constructor that accepts an array directly.
Assuming that array is of type String[], you could do
Vector vector = new Vector(Arrays.asList(array));
Better to use ArrayList as it doesn't have the overhead of having synchronized methods. You could use
List list = new ArrayList<>(Arrays.asList(array));
This will produce a mutable collection also.