ArrayUtil { public static <T> boolean hasIntersection(T[] from, T[] target) { if (isEmpty(target)) { return true; } if (isEmpty(from)) { return false; } for (int i = 0; i < from.length; i++) { for (int j = 0; j < target.length; j++) { if (from[i] == target[j]) { return true; } } } return false; }  static boolean isEmpty(T[] arrary); static boolean hasIntersection(T[] from, T[] target); static T[] toWrapperIfPrimitive(Object froms);  }
@Test public void testHasIntersection() { Class<?>[] from = new Class<?>[] {}; Class<?>[] target = new Class<?>[] {}; assertThat(ArrayUtil.hasIntersection(from, target), Matchers.is(true)); from = new Class<?>[] {String.class}; target = new Class<?>[] {}; assertThat(ArrayUtil.hasIntersection(from, target), Matchers.is(true)); from = new Class<?>[] {}; target = new Class<?>[] {String.class}; assertThat(ArrayUtil.hasIntersection(from, target), Matchers.is(false)); from = new Class<?>[] {String.class}; target = new Class<?>[] {String.class}; assertThat(ArrayUtil.hasIntersection(from, target), Matchers.is(true)); from = new Class<?>[] {String.class, Object.class}; target = new Class<?>[] {String.class}; assertThat(ArrayUtil.hasIntersection(from, target), Matchers.is(true)); from = new Class<?>[] {String.class}; target = new Class<?>[] {String.class, Object.class}; assertThat(ArrayUtil.hasIntersection(from, target), Matchers.is(true)); from = new Class<?>[] {Integer.class}; target = new Class<?>[] {Object.class}; assertThat(ArrayUtil.hasIntersection(from, target), Matchers.is(false)); }