@Test public void testRemoveDuplicate() { List<String> list1 = new ArrayList<>(); list1.add("AAA"); list1.add("BBB"); list1.add("CCC"); list1.add("AAA"); System.out.println(list1); System.out.println("====去重===="); System.out.println(CollectionHelper.removeDuplicate(list1)); }
public static <T> List<T> removeDuplicate(List<T> list) { if (list == null || list.size() == 0) { logger.error("list is empty or is null"); return new ArrayList<>(); } return new ArrayList<>(new HashSet<>(list)); }
CollectionHelper { public static <T> List<T> removeDuplicate(List<T> list) { if (list == null || list.size() == 0) { logger.error("list is empty or is null"); return new ArrayList<>(); } return new ArrayList<>(new HashSet<>(list)); } }
CollectionHelper { public static <T> List<T> removeDuplicate(List<T> list) { if (list == null || list.size() == 0) { logger.error("list is empty or is null"); return new ArrayList<>(); } return new ArrayList<>(new HashSet<>(list)); }  }
CollectionHelper { public static <T> List<T> removeDuplicate(List<T> list) { if (list == null || list.size() == 0) { logger.error("list is empty or is null"); return new ArrayList<>(); } return new ArrayList<>(new HashSet<>(list)); }  static void handler(Collection<T> collection, ObjectHandler<T> handler); static void process(Collection<T> collection, Collection<E> result, ObjectProcess<T, E> process); static List<T> removeDuplicate(List<T> list); static List<T> intersection(List<T> list1, List<T> list2); static Set<T> intersection(Set<T> set1, Set<T> set2); static Queue<T> intersection(Queue<T> queue1, Queue<T> queue2); static Map<K, V> intersection(Map<K, V> map1, Map<K, V> map2); static List<T> unicon(List<T> list1, List<T> list2); static Set<T> unicon(Set<T> set1, Set<T> set2); static Queue<T> unicon(Queue<T> queue1, Queue<T> queue2); static Map<K, V> unicon(Map<K, V> map1, Map<K, V> map2); static List<T> subtract(List<T> list1, List<T> list2); static Set<T> subtract(Set<T> set1, Set<T> set2); static Queue<T> subtract(Queue<T> queue1, Queue<T> queue2); static Map<K, V> subtract(Map<K, V> map1, Map<K, V> map2); static String join(Collection<T> collection, String separator); static String join(Map<K, V> map, String separator, String separator1); static String keyJoin(Map<K, V> map, String separator); static String valueJoin(Map<K, V> map, String separator); }
CollectionHelper { public static <T> List<T> removeDuplicate(List<T> list) { if (list == null || list.size() == 0) { logger.error("list is empty or is null"); return new ArrayList<>(); } return new ArrayList<>(new HashSet<>(list)); }  static void handler(Collection<T> collection, ObjectHandler<T> handler); static void process(Collection<T> collection, Collection<E> result, ObjectProcess<T, E> process); static List<T> removeDuplicate(List<T> list); static List<T> intersection(List<T> list1, List<T> list2); static Set<T> intersection(Set<T> set1, Set<T> set2); static Queue<T> intersection(Queue<T> queue1, Queue<T> queue2); static Map<K, V> intersection(Map<K, V> map1, Map<K, V> map2); static List<T> unicon(List<T> list1, List<T> list2); static Set<T> unicon(Set<T> set1, Set<T> set2); static Queue<T> unicon(Queue<T> queue1, Queue<T> queue2); static Map<K, V> unicon(Map<K, V> map1, Map<K, V> map2); static List<T> subtract(List<T> list1, List<T> list2); static Set<T> subtract(Set<T> set1, Set<T> set2); static Queue<T> subtract(Queue<T> queue1, Queue<T> queue2); static Map<K, V> subtract(Map<K, V> map1, Map<K, V> map2); static String join(Collection<T> collection, String separator); static String join(Map<K, V> map, String separator, String separator1); static String keyJoin(Map<K, V> map, String separator); static String valueJoin(Map<K, V> map, String separator);  }