List of utility methods to do List Remove Duplicate
List | removeDuplicates(List remove Duplicates List<T> list = new ArrayList<T>(); for (T item : collection) if (!list.contains(item)) list.add(item); return list; |
List | removeDuplicates(List Remove all duplicate objects from a list Set<T> s = new HashSet<>(); for (Iterator<T> iter = list.iterator(); iter.hasNext();) { T element = (T) iter.next(); if (!s.add(element)) { iter.remove(); return list; ... |
void | removeDuplicates(List Sorts and removes duplicate elements from list . Collections.sort(list, comparator); int j = 1; for (int i = 1; i < list.size(); i++) { if (comparator.compare(list.get(j - 1), list.get(i)) != 0) { T object = list.get(i); list.set(j++, object); if (j < list.size()) { list.subList(j, list.size()).clear(); |
void | removeDuplicates(List remove Duplicates for (ListIterator<V> it = lst.listIterator(); it.hasNext();) { int idx = it.nextIndex(); V elem = it.next(); if (idx < lst.size() - 1 && lst.subList(idx + 1, lst.size() - 1).contains(elem)) it.remove(); |
void | removeDuplicateWithOrder(List remove Duplicate With Order Set<String> set = new HashSet<String>(); List<String> newList = new ArrayList<String>(); for (Iterator<String> iter = list.iterator(); iter.hasNext();) { String element = iter.next(); if (set.add(element)) newList.add(element); list.clear(); ... |
List | removeDups(List remove Dups Set<T> set = new LinkedHashSet<T>(); set.addAll(in); if (set.size() == in.size()) return in; List<T> result = new ArrayList<T>(); for (T t : set) result.add(t); return result; ... |
List | removeEqualItems(List Ontdubbeld de items van deze lijst. if (list == null || list.isEmpty()) return list; T temp = null; List<T> sublist; for (int i = 0; i < list.size() - 1; i++) { temp = list.get(i); sublist = list.subList(i + 1, list.size()); while (sublist.remove(temp)) { ... |
List | removeRepeat(List remove Repeat if (isEmpty(list)) { return list; List<T> result = new ArrayList<T>(); for (T e : list) { if (!result.contains(e)) { result.add(e); return result; |
List | removeRepeat(List remove Repeat Map<Integer, T> map = new HashMap<Integer, T>(); if (list == null) return null; for (T t : list) { if (t == null) continue; map.put(t.hashCode(), t); try { list.clear(); list.addAll(map.values()); } catch (Exception e) { return new ArrayList<T>(map.values()); |
List | renameDuplicateStrings(List rename Duplicate Strings if (strNames == null) { return null; HashMap<String, Integer> seenBefore = new HashMap<String, Integer>(4); List<String> results = new ArrayList<String>(strNames.size()); for (String str : strNames) { Integer lookup = seenBefore.get(str); if (lookup == null) { ... |