java:Collection
3 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   muneer_smd
Posted On:   Sunday, May 21, 2006 11:30 PM

How to convert Arraylist to Vector? can anybody tell me?

Re: java:Collection

Posted By:   rahul123  
Posted On:   Wednesday, December 18, 2013 09:22 PM

There are two ways in so you can add ArrayList into Vector

ArrayList arList = new ArrayList();

Vector vector = new vector(arList);

2. Object obj = arList.get(0);
vector.add(index, obj);

Re: java:Collection

Posted By:   Anonymous  
Posted On:   Saturday, May 27, 2006 02:57 AM

You will have to get each object from ArrayList and then add to vector one by one.

Object ArrayList.get(index)
Vector.add(index,Object)

Re: java:Collection

Posted By:   WarnerJan_Veldhuis  
Posted On:   Monday, May 22, 2006 07:12 AM


Vector myVector = new Vector( myList );


The constructor of Vector takes a Collection as an argument.



If it's an existing Vector, you can use addAll(Collection) to copy the data.

About | Sitemap | Contact