Android List Intersect intersect(List first, List second)

Here you can find the source of intersect(List first, List second)

Description

intersect

License

Open Source License

Declaration

public static <T> List<T> intersect(List<T> first, List<T> second) 

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 <T> List<T> intersect(List<T> first, List<T> second) {
        ArrayList<T> result = new ArrayList<T>();
        for (T obj : first) {
            if (second.contains(obj)) {
                result.add(obj);//from ww w .  j  av  a  2  s  .  c  o  m
            }
        }
        return result;
    }
}

Related

  1. intersection(List list1, List list2)