Java List Intersect intersection(List list1, List list2)

Here you can find the source of intersection(List list1, List list2)

Description

intersection

License

Open Source License

Declaration

public static int intersection(List<String> list1, List<String> list2) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.ArrayList;

import java.util.List;

public class Main {
    public static int intersection(List<String> list1, List<String> list2) {
        List<String> intersection = new ArrayList<String>();

        for (String s : list1) {
            if (list2.contains(s)) {
                intersection.add(s);//from   w w w.  j a va 2 s  . co  m
            }
        }
        return intersection.size();
    }
}

Related

  1. intersection(final List list1, final List list2)
  2. intersection(List> sets)
  3. intersection(List list1, List list2)
  4. intersection(List list1, List list2)
  5. Intersection(List a, List b)
  6. intersection(List arrayOne, List arrayTwo)
  7. intersection(List listOne, List listTwo)
  8. intersection(List set1, List set2)
  9. intersection_type(List list1, List list2)