- //判断数组中是否有重复值
- public static boolean checkRepeat(String[] array){
- Set<String> set = new HashSet<String>();
- for(String str : array){
- set.add(str);
- }
- if(set.size() != array.length){
- return false;//有重复
- }else{
- return true;//不重复
- }
- }
- //该片段来自于http://www.codesnippet.cn/detail/100920135763.html
来源: http://www.codesnippet.cn/detail/100920135763.html