How to convert Vector to array in Java? 2 Examples

In the last article, we have learned how to convert a LinkedList to array in Java and in today's tutorial you will learn how to convert a Vector to array in Java. There is a similarity between Vector and LinkedList, both implements the List interface. Even though Vector is a legacy class and exists in Java from JDK 1.1 long before Java Collection framework was introduced, it was later retrofitted to implement the List interface. You can use the same toArray() method to convert a Vector to an array in Java. Similar to LinkedList, you can convert Vector of any object to an array of the corresponding object, the only restriction is that you cannot convert a vector of Integers to an array of ints or Vector of Float objects to an array of floats, which applies to our linked list solution as well.
Read more »