📅  最后修改于: 2022-03-11 14:52:43.643000             🧑  作者: Mango
ArrayList listWithDuplicateValues = new ArrayList<>();
list.add("first");
list.add("first");
list.add("second");
ArrayList uniqueList = (ArrayList) listWithDuplicateValues.stream().distinct().collect(Collectors.toList());