The java.util.vector.copyInto() method is used to copy all of the components from this vector to another array, having enough space to hold all of the components of the vector. It is to be noted that the index of the elements remains unchanged. The elements present in the array are replaced by the elements of the vector.
Parameters: The parameter array is of the type of vector. This is the array into which the elements of the vector are to be copied.
Return Value: The method is of void type and does not return any values.
Exception: The method throws NullPointerException if the array is NULL.
Below programs illustrates the Java.util.Vector.copyInto() method:
Vector: [Welcome, To, Geeks, 4, Geeks] The initial array is: Hello World null null null null The final array is: Welcome To Geeks 4 Geeks null
Vector: [10, 20, 30, 40, 50] The initial array is: 50 60 70 80 90 null The final array is: 10 20 30 40 50 null
- Stack copyInto() method in Java with Example
- Vector add() Method in Java
- Vector contains() Method in Java
- Vector get() Method in Java
- Vector set() Method in Java
- Vector removeIf() method in Java
- Vector removeAll() Method in Java
- Vector removeElementAt() Method in Java
- Vector remove() Method in Java
- Vector removeElement() method in Java with Example
- Vector removeRange() method in Java with Example
- Vector toString() method in Java with Example
- Vector lastElement() Method in Java
- Vector elementAt() Method in Java
- Vector indexOf() Method in Java
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.