@Test public void testCheckIfValueDuplicate() { List<String> list = new ArrayList<String>(aList); list.add(aList.get(0)); boolean result = ListUtil.checkIfValueDuplicate(list, true); Assert.assertTrue(list + " has no duplicate value.", result); list = new ArrayList<String>(aList); list.add(aList.get(0)); result = ListUtil.checkIfValueDuplicate(list, false); Assert.assertTrue(list + " has duplicate value.", result); list = new ArrayList<String>(aList); list.add(aList.get(0)); list.set(list.size() - 1, list.get(list.size() - 1).toUpperCase()); result = ListUtil.checkIfValueDuplicate(list, true); Assert.assertTrue(list + " has duplicate value.", result == false); list = new ArrayList<String>(aList); list.add(aList.get(0)); list.set(list.size() - 1, list.get(list.size() - 1).toUpperCase()); result = ListUtil.checkIfValueDuplicate(list, false); Assert.assertTrue(list + " has duplicate value.", result); }
public static boolean checkIfValueDuplicate(List<String> aList, boolean caseSensitive) { if (null == aList || aList.isEmpty()) { throw DataXException.asDataXException(CommonErrorCode.CONFIG_ERROR, "您提供的作业配置有误，List不能为空."); } try { makeSureNoValueDuplicate(aList, caseSensitive); } catch (Exception e) { return true; } return false; }
ListUtil { public static boolean checkIfValueDuplicate(List<String> aList, boolean caseSensitive) { if (null == aList || aList.isEmpty()) { throw DataXException.asDataXException(CommonErrorCode.CONFIG_ERROR, "您提供的作业配置有误，List不能为空."); } try { makeSureNoValueDuplicate(aList, caseSensitive); } catch (Exception e) { return true; } return false; } }
ListUtil { public static boolean checkIfValueDuplicate(List<String> aList, boolean caseSensitive) { if (null == aList || aList.isEmpty()) { throw DataXException.asDataXException(CommonErrorCode.CONFIG_ERROR, "您提供的作业配置有误，List不能为空."); } try { makeSureNoValueDuplicate(aList, caseSensitive); } catch (Exception e) { return true; } return false; }  }
ListUtil { public static boolean checkIfValueDuplicate(List<String> aList, boolean caseSensitive) { if (null == aList || aList.isEmpty()) { throw DataXException.asDataXException(CommonErrorCode.CONFIG_ERROR, "您提供的作业配置有误，List不能为空."); } try { makeSureNoValueDuplicate(aList, caseSensitive); } catch (Exception e) { return true; } return false; }  static boolean checkIfValueDuplicate(List<String> aList,
                                                boolean caseSensitive); static void makeSureNoValueDuplicate(List<String> aList,
                                                boolean caseSensitive); static boolean checkIfBInA(List<String> aList, List<String> bList,
                                      boolean caseSensitive); static void makeSureBInA(List<String> aList, List<String> bList,
                                    boolean caseSensitive); static boolean checkIfValueSame(List<Boolean> aList); static List<String> valueToLowerCase(List<String> aList); }
ListUtil { public static boolean checkIfValueDuplicate(List<String> aList, boolean caseSensitive) { if (null == aList || aList.isEmpty()) { throw DataXException.asDataXException(CommonErrorCode.CONFIG_ERROR, "您提供的作业配置有误，List不能为空."); } try { makeSureNoValueDuplicate(aList, caseSensitive); } catch (Exception e) { return true; } return false; }  static boolean checkIfValueDuplicate(List<String> aList,
                                                boolean caseSensitive); static void makeSureNoValueDuplicate(List<String> aList,
                                                boolean caseSensitive); static boolean checkIfBInA(List<String> aList, List<String> bList,
                                      boolean caseSensitive); static void makeSureBInA(List<String> aList, List<String> bList,
                                    boolean caseSensitive); static boolean checkIfValueSame(List<Boolean> aList); static List<String> valueToLowerCase(List<String> aList);  }