现在:
我想要:
代码:
String[] contact = new String[contact_phoneList.size()];
for (int i = 0; i < contact_phoneList.size(); i++) {
contact [i] = contact_phoneList.get(i);
}
答案 0 :(得分:2)
使用HashSet删除重复的值:
HashSet hs = new HashSet();
hs.addAll(contact_phoneList); // name of contact_phoneList from which you want to remove duplicates
contact_phoneList.clear();
contact_phoneList.addAll(hs);
不需要for
循环