Java List Intersect intersection(List list1, List list2)

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

Description

intersection

License

LGPL

Declaration

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

Method Source Code


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

import java.util.Arrays;

import java.util.List;

public class Main {
    public static <E> List<E> intersection(List<E> list1, List<E> list2) {
        list1.retainAll(list2);//w ww .  ja  v a 2s  .c  o m
        return list1;
    }

    public static <E> List<E> intersection(E[] array1, E[] array2) {
        return intersection(Arrays.asList(array1), Arrays.asList(array2));
    }
}

Related

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