ArrayList<String> 转化为String数组:
String[] phones = (String[]) list.toArray();
报错:java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Ljava.lang.String;
改为如下代码即可:
String[] phones = list.toArray(new String[list.size()]);
ArrayList<String> 转化为String数组:
String[] phones = (String[]) list.toArray();
改为如下代码即可:
String[] phones = list.toArray(new String[list.size()]);