TCLUG Development Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Vector.toArray()



Am I missing something here?

I want to convert a Vector of Strings to an array of Strings.

Vector foo = new Vector()
foo.add("1");
foo.add("2");
foo.add("3");
foo.add("4");

String[] blah = new String[4];
blah = (String[])foo.toArray();

Should this work?

-- 
Bob Tanner <tanner@real-time.com>       | Phone : (952)943-8700
http://www.mn-linux.org                 | Fax   : (952)943-8500
Key fingerprint =  6C E9 51 4F D5 3E 4C 66 62 A9 10 E5 35 85 39 D9