I have a collection of String[] values, for example:
ArrayList<String[]> values = new ArrayList<>();
String[] data1 = new String[]{"asd", "asdds", "ds"};
String[] data2 = new String[]{"dss", "21ss", "pp"};
values.add(data1);
values.add(data2);
And I need convert this to multidimensional array String[][]. When I try this:
String[][] arr = (String[][])values.toArray();
I get a ClassCastException
.
How can I solve this problem?