List of utility methods to do Collection Intersect
Collection | intersection(final Collection intersection if (a == null || a.size() == 0 || b == null || b.size() == 0) { return null; List<T> result = new ArrayList<T>(); Map<T, Integer> mapa = getCardinalityMap(a); Map<T, Integer> mapb = getCardinalityMap(b); Set<T> elts = new HashSet<T>(a); elts.addAll(b); ... |
List | intersection(final Collection return a such that a exists in c1 and a exists in c2. if (c1 == null || c2 == null) { return new ArrayList<>(); if (c1.size() == 0 || c2.size() == 0) { return new ArrayList<>(); final List<T> intersection = new ArrayList<>(); for (final T current : c1) { ... |
int | intersectionSize(Collection c1, Collection c2) Calculate the size of intersection between two collections. int size = 0; if (c1.size() < c2.size()) { for (Object o : c1) { if (c2.contains(o)) { size++; } else { ... |
boolean | intersects(Collection c1, Collection c2) Checks if two collections have any elemnts in common for (Iterator i = c1.iterator(); i.hasNext();) { if (c2.contains(i.next())) return true; return false; |
boolean | intersects(Collection Returns whether two collections have any elements in common. for (E e : c1) { if (c0.contains(e)) { return true; return false; |
boolean | intersectsWith(Collection> S1, Collection> S2) check whether set S1 intersects with the set S2 for (Object o : S1) { if (S2.contains(o)) { return true; return false; |
ArrayList | makeIntersection(Collection extends K> a, Collection extends K> b) make Intersection ArrayList<K> intersection = new ArrayList<K>(); if (a != null && b != null && b.size() > 0) { K o = null; for (Iterator<? extends K> iter = a.iterator(); iter.hasNext();) { o = iter.next(); if (b.contains(o)) intersection.add(o); return intersection; |
int | sizeOfIntersection(Collection> a, Collection> b) size Of Intersection int count = 0; for (Object o : a) if (b.contains(o)) count++; return count; |