Java List Intersect intersection(List arrayOne, List arrayTwo)

Here you can find the source of intersection(List arrayOne, List arrayTwo)

Description

intersection

License

Open Source License

Declaration

public static <T> List<T> intersection(List<T> arrayOne, List<T> arrayTwo) 

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> intersection(List<T> arrayOne, List<T> arrayTwo) {
        List<T> _intersect = new ArrayList<T>();
        for (int i = 0; i < arrayOne.size(); i++) {
            for (int j = 0; j < arrayTwo.size(); j++) {
                if (arrayOne.get(i) == arrayTwo.get(j)) {
                    _intersect.add(arrayOne.get(i));
                }/*  www. j a  va 2 s.  c om*/
            }
        }

        return _intersect;
    }
}

Related

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