List of utility methods to do List Difference
List | diff(List ls, List ls2) diff List list = new ArrayList(Arrays.asList(new Object[ls.size()])); Collections.copy(list, ls); list.removeAll(ls2); return list; |
List | diff(List returns a list with the values difference values doublesA-doublesB if (doublesA.size() != doublesB.size()) { throw new IllegalArgumentException("The two lists must be of same size!"); List<Double> diff = new ArrayList<Double>(doublesA.size()); for (int i = 0; i < doublesA.size(); i++) { diff.add(doublesA.get(i) - doublesB.get(i)); return diff; ... |
Set | diffAsSet(Collection Returns all objects in list1 that are not in list2. Set<T> diff = new HashSet<>(); for (T t : list1) { if (!list2.contains(t)) { diff.add(t); return diff; |
List | difference(final List extends Object> minuend, final List extends Object> subtrahend) difference final List<Double> result = new ArrayList<Double>(); for (int i = 0; i < minuend.size(); ++i) { final Object o1 = minuend.get(i); final Object o2 = subtrahend.get(i); if (areBothNumbers(o1, o2)) { subtract(result, o1, o2); } else { result.add(Double.NaN); ... |
List | difference(final List extends T> list1, final List extends T> list2) difference final List<T> result = new ArrayList<T>(list1); final Iterator<? extends T> iterator = list2.iterator(); while (iterator.hasNext()) { result.remove(iterator.next()); return result; |
String[] | difference(final String[] list1, final String[] list2) The difference set operation HashSet<String> set = new HashSet<String>(); HashSet<String> set1 = new HashSet<String>(Arrays.asList(list1)); HashSet<String> set2 = new HashSet<String>(Arrays.asList(list2)); for (final String s : list1) { if (!set2.contains(s)) { set.add(s); for (final String s : list2) { if (!set1.contains(s)) { set.add(s); return set.toArray(new String[set.size()]); |
List | difference(List Returns the set difference of the given lists. List<E> results = create(); if (firstList != null) results.addAll(firstList); if (secondList != null) results.removeAll(secondList); return results; |
void | difference(List difference for (T1 elem : lst2) {
lst1.remove(elem);
|
List | difference(List difference List<T> diff = new ArrayList<T>(set1); diff.removeAll(set2); return diff; |
List | differenceOfList(List extends E> a, List extends E> b) difference Of List List<E> result = new ArrayList<>(); for (E i : a) { if (b.contains(i)) continue; result.add(i); return result; |