List of utility methods to do List Intersect
List | intersection(final List extends T> list1, final List extends T> list2) intersection List<? extends T> smaller = list1; List<? extends T> larger = list2; if (list1.size() > list2.size()) { smaller = list2; larger = list1; List<T> newSmaller = new ArrayList<T>(smaller); List<T> result = new ArrayList<T>(smaller.size()); ... |
Set | intersection(List intersection if (sets.isEmpty()) return Collections.emptySet(); Set<T> accum = new HashSet<>(); accum.addAll(sets.get(0)); for (int i = 1; i < sets.size(); i++) { accum = intersection(accum, sets.get(i)); return accum; ... |
List | intersection(List intersection list1.retainAll(list2);
return list1;
|
List | intersection(List intersection if (list1 == null || list2 == null) throw new NullPointerException("Not initizalized lists"); List<E> intersection = new LinkedList<E>(); E item; ListIterator<E> iter = list1.listIterator(); while (iter.hasNext()) { item = iter.next(); if (list2.contains(item)) { ... |
List | Intersection(List Intersection List<Integer> C = new ArrayList<Integer>(); for (Integer i : a) { if (b.contains(i)) { C.add(i); return C; |
int | intersection(List intersection List<String> intersection = new ArrayList<String>(); for (String s : list1) { if (list2.contains(s)) { intersection.add(s); return intersection.size(); |
List | intersection(List intersection List<T> _intersect = new ArrayList<T>(); for (int i = 0; i < arrayOne.size(); i++) { for (int j = 0; j < arrayTwo.size(); j++) { if (arrayOne.get(i) == arrayTwo.get(j)) { _intersect.add(arrayOne.get(i)); return _intersect; |
List | intersection(List intersection ArrayList<T> onlyInOne = new ArrayList<T>(listOne); onlyInOne.removeAll(listTwo); ArrayList<T> inBoth = new ArrayList<T>(listOne); inBoth.removeAll(onlyInOne); return inBoth; |
List | intersection(List intersection List<T> intSet = new ArrayList<T>(set1); intSet.retainAll(set2); return intSet; |
int | intersection_type(List This will determine the intersection type of two list Note: undirected 1 vs 2 List<T> tmp = intersection(list1, list2); if (tmp.size() == list2.size() && tmp.size() == list1.size()) return 1; if (tmp.size() < list2.size() && tmp.size() == list1.size()) return 2; if (tmp.size() < list1.size() && tmp.size() == list2.size()) return 5; if (tmp.size() > 0) ... |