Is this you? As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.
Claim your profile
The list.toArray idiom you employ here is not parametrized by an array of your List's parametrized type, so it returns Object[]. For instance, with your List<String> str, you can invoke: String[] foo = str.toArray(new String[str.size()]); without casting. The problem here is that, due to Java generics' design, you can never initialize a new E[], hence you have to cast to (E[]). I cannot see this throwing a ClassCastException ever as is.
As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.