Tuesday, May 15, 2007

Java: Convert array of Objects to a List or a Vector


Given an array of objects (not primitives), convert it to a List or a Vector as follows:
// myArray[] is an array of Objects
// Arrays is java.util.Array
List myList = Arrays.asList(myArray);
Vector myVector = new Vector(Arrays.asList(MyArray));

No comments:

Back to Top


 

Labels