/**
* 根据照片名称去重
*/
fun duplicateRemoval(list: MutableList<MediaBean>): MutableList<MediaBean>? {
val mediaBeanList: MutableSet<MediaBean> =
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
TreeSet(Comparator.comparing(MediaBean::fileName))
} else {
//7.0以下版本照片去重
TODO()
}
mediaBeanList.addAll(list)
return mediaBeanList.toMutableList()
}
我这里是根据fileName字段来进行去重的