You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
udi-cpt-java/src/main/java/com/glxp/api/util/CheckUtils.java

34 lines
948 B
Java

package com.glxp.api.util;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class CheckUtils {
public static Boolean checkCode(List<String> list) {
Set<String> set = new HashSet<String>(list);
boolean result = list.size() == set.size() ? true : false;
return result;
}
public static String getRepeatIdCard(List<String> list) {
StringBuffer buffer = new StringBuffer();
buffer.append("重复值是:");
String temp = "";
for (int i = 0; i < list.size() - 1; i++) {
temp = list.get(i);
for (int j = i + 1; j < list.size(); j++) {
if (temp.equals(list.get(j))) {
System.out.println("第" + (i + 1) + "个跟第" + (j + 1) + "个重复,值是:" + temp);
buffer.append(temp + ",");
}
}
}
return buffer.toString();
}
}