java List去重,并且保持顺序
List<T> list = new ArrayList<>(); Set set = new HashSet(); List<T> newList = new ArrayList<>(); for (T element : list) { //set能添加进去就代表不是重复的元素 if (set.add(element.getId())) ne