Android List Intersect intersection(List list1, List list2)

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

Description

intersection

Declaration

public static <T> List<T> intersection(List<T> list1, List<T> list2) 

Method Source Code

//package com.java2s;
import java.util.ArrayList;
import java.util.List;

public class Main {
    public static <T> List<T> intersection(List<T> list1, List<T> list2) {
        List<T> ret = new ArrayList<T>();
        for (T i : list1) {
            if (list2.contains(i))
                ret.add(i);//from   w  w w . ja  va 2  s. c  o  m
        }
        return ret;
    }
}

Related

  1. intersect(List first, List second)