Java List Intersect intersection(List set1, List set2)

Here you can find the source of intersection(List set1, List set2)

Description

intersection

License

Apache License

Declaration

public static <T> List<T> intersection(List<T> set1, List<T> set2) 

Method Source Code


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

import java.util.ArrayList;

import java.util.List;

public class Main {
    public static <T> List<T> intersection(List<T> set1, List<T> set2) {
        List<T> intSet = new ArrayList<T>(set1);
        intSet.retainAll(set2);//  w w  w . j a  v a  2  s. c o  m

        return intSet;
    }
}

Related

  1. intersection(List list1, List list2)
  2. Intersection(List a, List b)
  3. intersection(List list1, List list2)
  4. intersection(List arrayOne, List arrayTwo)
  5. intersection(List listOne, List listTwo)
  6. intersection_type(List list1, List list2)
  7. intersectionInplace(List> sets)
  8. intersectList(List list1, List list2)
  9. intersectSortedAscending(List l1, List l2)