List of utility methods to do Collection Intersect
Set | intersection(Collection extends Collection Returns the intersection of the Collection s of the given container Collection Set<E> retset = new LinkedHashSet<E>(); if (!collectionOfCollections.isEmpty()) { final Iterator<? extends Collection<E>> collectionOfCollectionsIterator = collectionOfCollections .iterator(); Collection<E> collection = collectionOfCollectionsIterator.next(); if (collection != null) { retset.addAll(collection); while (collectionOfCollectionsIterator.hasNext()) { final Collection<E> collectionOther = collectionOfCollectionsIterator.next(); if (collectionOther != null) { retset.retainAll(collectionOther); return retset; |
List | intersection(Collection extends Collection intersection List<T> result = new ArrayList<T>(); Iterator<? extends Collection<T>> iterator = availableValuesByDescriptor.iterator(); if (iterator.hasNext()) { Collection<T> firstSet = iterator.next(); result.addAll(firstSet); while (iterator.hasNext()) { Collection<T> next = iterator.next(); result.retainAll(next); ... |
List | intersection(Collection Returns a new List with only this elements which are in all of the given Collection s final List<E> retlist = new ArrayList<E>(); if (collections.length > 0) { Collection<E> collection = collections[0]; if (collection != null) { retlist.addAll(collection); for (int ii = 1; ii < collections.length && !retlist.isEmpty(); ii++) { Collection<E> collectionOther = collections[ii]; ... |
Set | intersection(Collection Determines the intersection of a collection of sets. Set<T> result = new HashSet<>(); if (sets.isEmpty()) { return result; Iterator<Set<T>> iter = sets.iterator(); result.addAll(iter.next()); while (iter.hasNext()) { result.retainAll(iter.next()); ... |
List | intersection(Collection intersection List<T> list = new ArrayList<T>(); for (T element : a) { if (b.contains(element)) { list.add(element); return list; |
Collection | intersection(Collection Intersection of two collections with duplicates return null;
|
Iterable | intersection(Collection iterator over all elements contained in the intersection of the two collections return () -> new Iterator<T>() { final Iterator<T> it = a.iterator(); T v = null; while (it.hasNext()) { v = it.next(); if (b.contains(v)) break; ... |
List | intersection(Collection intersection Set<T> added = new HashSet<T>(), set2 = new HashSet<T>(values2); List<T> results = new ArrayList<T>(); for (T value : values1) { if (set2.contains(value) && !added.contains(value)) { results.add(value); added.add(value); return results; |
Collection | intersection(final Collection a, final Collection b) intersection ArrayList list = new ArrayList(); Map mapa = getCardinalityMap(a); Map mapb = getCardinalityMap(b); Set elts = new LinkedHashSet(a); elts.addAll(b); Iterator it = elts.iterator(); while (it.hasNext()) { Object obj = it.next(); ... |
Collection | intersection(final Collection c1, final Collection c2) the intersection of two collections. final List list = new ArrayList(); final Object[] members_c1 = c1.toArray(); for (int i = 0; i < members_c1.length; i++) { if (c2.contains(members_c1[i])) { list.add(members_c1[i]); return list; ... |