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[]
If you use Guava in your project you can use Iterables::toArray.
Foo[] foos = Iterables.toArray(x, Foo.class);