Java Array Intersect isArrayIntersect(Object[] objArr1, Object[] objArr2)

Here you can find the source of isArrayIntersect(Object[] objArr1, Object[] objArr2)

Description

is Array Intersect

License

Apache License

Declaration

public static boolean isArrayIntersect(Object[] objArr1,
        Object[] objArr2) 

Method Source Code

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

import java.util.Arrays;

import java.util.List;

public class Main {

    public static boolean isArrayIntersect(Object[] objArr1,
            Object[] objArr2) {/*  ww  w .  j a  v  a  2 s .c  o  m*/
        return isListIntersect(Arrays.asList(objArr1),
                Arrays.asList(objArr2));
    }

    public static boolean isListIntersect(List list1, List list2) {
        for (int i = 0; i < list1.size(); i++)
            if (list2.contains(list1.get(i)))
                return true;
        return false;
    }
}

Related

  1. intersection(final long[] array1, final long[] array2)
  2. intersection(int[] array1, int[] array2)
  3. intersection(String[] ary1, String[] ary2)
  4. intersection(String[] ss1, String[] ss2)
  5. intersectRanges(int[] range1, int[] range2)