Java集合可以通过以下几种方式实现去重:
List<String> list = new ArrayList<>();
list.add("apple");
list.add("banana");
list.add("apple");
Set<String> set = new HashSet<>(list);
System.out.println(set); // [apple, banana]
List<String> list = new ArrayList<>();
list.add("apple");
list.add("banana");
list.add("apple");
List<String> distinctList = list.stream().distinct().collect(Collectors.toList());
System.out.println(distinctList); // [apple, banana]
List<String> list = new ArrayList<>();
list.add("apple");
list.add("banana");
list.add("apple");
CollectionUtils.removeDuplicates(list);
System.out.println(list); // [apple, banana]