how to remove duplicate item from arraylist in java using comparator

Solutions on MaxInterview for how to remove duplicate item from arraylist in java using comparator by the best coders in the world

showing results for - "how to remove duplicate item from arraylist in java using comparator"
Crosby
07 May 2016
1Set<FilterModel> set = new TreeSet<>(new Comparator<FilterModel>() {
2@Override
3public int compare(FilterModel o1, FilterModel o2) {
4if (o1.getFtype().equalsIgnoreCase(o2.getFtype())) {
5return 0;
6}
7return 1;
8}
9});
10
11set.addAll(filterlist);
12filterlist.clear();
13filterlist.addAll(set);
14