String[] str = new String[]{"a","b","a"}; Set set = new HashSet(); for (int i = 0; i < str.length; i++) { set.add(str[i]); } str = (String[]) set.toArray(new String[0]);
去除字符串数组中重复的值
最新推荐文章于 2023-11-28 00:27:59 发布
String[] str = new String[]{"a","b","a"}; Set set = new HashSet(); for (int i = 0; i < str.length; i++) { set.add(str[i]); } str = (String[]) set.toArray(new String[0]);