code: @SuppressWarnings("unchecked")
    public static <T> T[] intersect(Class<T> arrayType, T[] first, T[] second) {
      List<T> result = intersect(first, second);
      return result.toArray((T[]) Array.newInstance(arrayType, result.size()));
    }
docs: Returns an array containing containing only elements found in {@code first}  and also in
  {@code second}. The returned elements are in the same order as in {@code first}.