Java Collection Intersect intersection(Collection a, Collection b)

Here you can find the source of intersection(Collection a, Collection b)

Description

intersection

License

Apache License

Declaration

public static <T> List<T> intersection(Collection<T> a, Collection<T> b) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.util.*;

public class Main {

    public static <T> List<T> intersection(Collection<T> a, Collection<T> b) {
        List<T> list = new ArrayList<T>();

        for (T element : a) {
            if (b.contains(element)) {
                list.add(element);/*from www  .  ja va  2 s . co  m*/
            }
        }
        return list;
    }
}

Related

  1. intersection(Collection a, Collection b)
  2. intersection(Collection> collectionOfCollections)
  3. intersection(Collection> availableValuesByDescriptor)
  4. intersection(Collection... collections)
  5. intersection(Collection> sets)
  6. intersection(Collection a, Collection b)
  7. intersection(Collection a, Collection b)
  8. intersection(Collection values1, Collection values2)
  9. intersection(final Collection a, final Collection b)