Suppose we have a Collection. What is the best (shortest in LoC in current context) way to transform it to Foo[]? Any well-known
Collection
Foo[]
For the original see doublep answer:
Foo[] a = x.toArray(new Foo[x.size()]);
As for the update:
int i = 0; Bar[] bars = new Bar[fooCollection.size()]; for( Foo foo : fooCollection ) { // where fooCollection is Collection bars[i++] = new Bar(foo); }