Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

List To Vector

Status
Not open for further replies.

kohinoor2007

Programmer
Mar 21, 2007
69
0
0
DE
Hi,

One of my function calls return something as follows.

Set<String> tags = test.GetTags();

Want to put these strings into a comboBox on creation.The combobox constructor are as follows:

JComboBox(Object[])
JComboBox(Vector)

Is it possible to convert the "Set" collection to an Object or vector...


Tried

Object[] a = tags.toArray(); // But there was an error ,that cant convert string to object[].

List<String> test = new ArrayList<String>(test.GetTags()); // This returns a List,but want a vector or Object.


Is there any way around ,instead of creating a vector or Object type , & putting all the elements into it...

Thanks


 
Did something as follows & it worked.

Set<String> tags = test.GetTags();
Object[] tagsList = tags.toArray();
new JComboBox(tagsList);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top