This will work for Java 1.2 and up. You should be able to do this: BObj a[] = (BObj[]) v.toArray(); However, unless you need thread safety or Java 1.0 or 1.1 compatability, you should use java.util.ArrayList. On Tue, 30 Oct 2001, Bob Tanner wrote: > Is there a simple way to convert a Vector of Object to and Array of Objects of > the same type? > > What I'm doing now is something like this: > > Vector v = new Vector(); > > <snip> > v.add(obj) > <snip> > > // Ok, vector has a bunch of Object in it > > int size = v.size(); > BobObj obj = new BobObj[size]; > > for (int i = 0; i < size; i++) { > // Walk the vector making it into an Array > obj[i] = new BobObj(result.get(i)); > } > > I look at the Vector.toArray() thinking that would solve my problem, but I can't > seem to get it to work. > > > -- > Bob Tanner <tanner at real-time.com> | Phone : (952)943-8700 > http://www.mn-linux.org, Minnesota, Linux | Fax : (952)943-8500 > Key fingerprint = 6C E9 51 4F D5 3E 4C 66 62 A9 10 E5 35 85 39 D9 > > _______________________________________________ > tclug-devel mailing list > tclug-devel at mn-linux.org > https://mailman.mn-linux.org/mailman/listinfo/tclug-devel > -Chris McKinley finger lamfada at lugh.net for GPG key