This question already has an answer here:
I want to know if it's possible to convert a Java
List
of String
s to an Array
of String
s:
I tried this:
List<String> products = new ArrayList<String>();
//some codes..
String[] arrayCategories = (String[]) products.toArray();
but it gives me an exception message: "java.lang.ClassCastException: java.lang.Object[] cannot be cast to java.lang.String[]"
thanks!