Daftar ke vektor java
// Java program to Convert ArrayList to Vector
import java.util.ArrayList;
import java.util.Vector;
public class GFG {
public static void main(String[] args)
{
// create ArrayList
ArrayList<Integer> ArrList = new ArrayList<Integer>();
// add elements in ArrayList
ArrList.add(10);
ArrList.add(20);
ArrList.add(30);
ArrList.add(40);
ArrList.add(50);
// display ArrayList
System.out.println(" ArrayList : " + ArrList);
// create vector and pass the ArrayList in vector
// constructor
Vector<Integer> vector = new Vector<Integer>(ArrList);
// print vector
System.out.println(" Vector : " + vector);
}
}
Hachem Guesmi