方法之一:List集合转化成Set集合,
去重后,如果还需要List类型的参数,在把set对象转回成List对象就好了
//有重复数据的list对象
List<ImgEntryResponse> mImgHistoryList = new ArrayList();
//set去重,set集合添加List数据
Set<ImgEntryResponse> mSetHistoryList = new HashSet<ImgEntryResponse>();
mSetHistoryList.addAll(mImgHistoryList);
//Set转化成List
List<ImgEntryResponse> mListOnly = new ArrayList<>(mSetHistoryList);
//如果需要排序的话使用LinkedHashSet...唯一而且有序
有问题私信作者me…