Join
Blogs
Questions
Videos
Tags
Members
Search
 
 
Create your own blog, earn points and get popular!

Java Array to Vector

Hi All,

Another question :). I want to convert Java array to Vector object. Any help is appreciated. Any example to convert Java array to Vector?
No votes yet
Share this
3 answers
Andr's picture
There is something wrong with the CKEditor when anything is posted from word directly. Looking forward to resolve that issue asap.
Your rating: None Average: 3 (1 vote)
hertze_bogdan's picture
Array is used to store similar data types while Vector is used to store object data types.
  1. // declare and initialize array of object of given class.
  2. Object[] arrObject = {"Hello", new Date(), "World"};
  3. //create list for this object array.
  4. List list = Arrays.asList(arrObject);
  5. // create vector for given list.
  6. Vector vector = new Vector(list);
  7. // access the elements of the vector.
  8.  Enumeration enume = vector.elements(); while (enume.hasMoreElements()) { System.out.println(enume.nextElement().toString());
I hope this helped.
No votes yet
hertze_bogdan's picture
Well, read between the lines. :) this code editor its a crap.
No votes yet