Zip together the "a" and "b" arrays until one of them runs out of values.
Each pair of values is combined into a single value using the supplied zipFunction function.

@param a
@param b
@return
4110
public static IntStream zip(final int[] a, final int[] b, final IntBiFunction<Integer> zipFunction) {
        return Stream.zip(a, b, zipFunction).mapToInt(ToIntFunction.UNBOX);
    }
1216258
@SuppressWarnings("unchecked")
    public static <T1, T2> Tuple2<T1, T2>[] zip(T1[] arr1, T2[] arr2) {
        int resultSize = _max(arr1.length, arr2.length);
        Tuple2[] result = new Tuple2[resultSize];

        for (int i = 0; i < resultSize; i++)
            result[i] = tuple(next(arr1, i), next(arr2, i));

        return result;
    }
742251
public static <A, B, C, R> Stream<R> zip(final A[] a, final B[] b, final C[] c, final TriFunction<? super A, ? super B, ? super C, R> zipFunction) {
        return zip(ObjIteratorEx.of(a), ObjIteratorEx.of(b), ObjIteratorEx.of(c), zipFunction);
    }
32558
public static <A, B, R> Stream<R> zip(final Collection<? extends A> a, final Collection<? extends B> b,
            final BiFunction<? super A, ? super B, R> zipFunction) {
        return zip(a.iterator(), b.iterator(), zipFunction);
    }
616696
@SuppressWarnings("unchecked")
    public static <T1, T2, T3> Tuple3<T1, T2, T3>[] zip(T1[] arr1, T2[] arr2, T3[] arr3) {
        int resultSize = _max(arr1.length, arr2.length, arr3.length);
        Tuple3[] result = new Tuple3[resultSize];

        for (int i = 0; i < resultSize; i++)
            result[i] = tuple(next(arr1, i), next(arr2, i), next(arr3, i));

        return result;
    }
183899
public static DoubleStream zip(final double[] a, final double[] b, final double[] c, final DoubleTriFunction<Double> zipFunction) {
        return Stream.zip(a, b, c, zipFunction).mapToDouble(ToDoubleFunction.UNBOX);
    }
905512
public static <R> Stream<R> zip(final IntIterator a, final IntIterator b, final IntBiFunction<R> zipFunction) {
        return new IteratorStream<>(new ObjIteratorEx<R>() {
            @Override
            public boolean hasNext() {
                return a.hasNext() && b.hasNext();
            }

            @Override
            public R next() {
                return zipFunction.apply(a.nextInt(), b.nextInt());
            }
        });
    }
529382
@SuppressWarnings("resource")
    public static <R> Stream<R> zip(final Collection<? extends DoubleStream> c, final DoubleNFunction<R> zipFunction) {
        if (N.isNullOrEmpty(c)) {
            return Stream.empty();
        }

        final int len = c.size();
        final DoubleIterator[] iters = new DoubleIterator[len];
        int i = 0;

        for (DoubleStream s : c) {
            iters[i++] = s.iteratorEx();
        }

        return new IteratorStream<>(new ObjIteratorEx<R>() {
            @Override
            public boolean hasNext() {
                for (int i = 0; i < len; i++) {
                    if (iters[i].hasNext() == false) {
                        return false;
                    }
                }

                return true;
            }

            @Override
            public R next() {
                final double[] args = new double[len];

                for (int i = 0; i < len; i++) {
                    args[i] = iters[i].nextDouble();
                }

                return zipFunction.apply(args);
            }
        }).onClose(newCloseHandler(c));
    }
1040102
@Override
    public <U> Future<Tuple2<T, U>> zip(final Iterable<? extends U> other) {
        return (Future) Zippable.super.zip(other);
    }
720340
@SuppressWarnings("resource")
    public static <R> Stream<R> zip(final Collection<? extends IntStream> c, final IntNFunction<R> zipFunction) {
        if (N.isNullOrEmpty(c)) {
            return Stream.empty();
        }

        final int len = c.size();
        final IntIterator[] iters = new IntIterator[len];
        int i = 0;

        for (IntStream s : c) {
            iters[i++] = s.iteratorEx();
        }

        return new IteratorStream<>(new ObjIteratorEx<R>() {
            @Override
            public boolean hasNext() {
                for (int i = 0; i < len; i++) {
                    if (iters[i].hasNext() == false) {
                        return false;
                    }
                }

                return true;
            }

            @Override
            public R next() {
                final int[] args = new int[len];

                for (int i = 0; i < len; i++) {
                    args[i] = iters[i].nextInt();
                }

                return zipFunction.apply(args);
            }
        }).onClose(newCloseHandler(c));
    }
972529
function zip(arrayOfArrays) {
  return arrayOfArrays[0].map(function(_, secondIndex) {
    return arrayOfArrays.map(function(_, firstIndex) {
      return arrayOfArrays[firstIndex][secondIndex];
    });
  });
}
1053259
private static Integer[] mergeDocLists(Integer[] a, Integer[] b) {
    Integer[] answer = new Integer[a.length + b.length];
    int i = 0;
    int j = 0;
    int k = 0;
    Integer tmp;
    while (i < a.length && j < b.length) {
      tmp = a[i] < b[j] ? a[i++] : b[j++];
      for (; i < a.length && a[i].equals(tmp); i++)
        ;
      for (; j < b.length && b[j].equals(tmp); j++)
        ;
      answer[k++] = tmp;
    }
    while (i < a.length) {
      tmp = a[i++];
      for (; i < a.length && a[i].equals(tmp); i++)
        ;
      answer[k++] = tmp;
    }
    while (j < b.length) {
      tmp = b[j++];
      for (; j < b.length && b[j].equals(tmp); j++)
        ;
      answer[k++] = tmp;
    }
    return Arrays.copyOf(answer, k);
  }
735480
public <T2, R> ValueTransformer<W,R> zip(Iterable<? extends T2> iterable,
            BiFunction<? super T, ? super T2, ? extends R> fn) {
        return this.unitAnyM(this.transformerStream().map(v->v.zip(iterable,fn)));
    }
322605
@SuppressWarnings("resource")
    public static <R> Stream<R> zip(final Collection<? extends ByteStream> c, final ByteNFunction<R> zipFunction) {
        if (N.isNullOrEmpty(c)) {
            return Stream.empty();
        }

        final int len = c.size();
        final ByteIterator[] iters = new ByteIterator[len];
        int i = 0;

        for (ByteStream s : c) {
            iters[i++] = s.iteratorEx();
        }

        return new IteratorStream<>(new ObjIteratorEx<R>() {
            @Override
            public boolean hasNext() {
                for (int i = 0; i < len; i++) {
                    if (iters[i].hasNext() == false) {
                        return false;
                    }
                }

                return true;
            }

            @Override
            public R next() {
                final byte[] args = new byte[len];

                for (int i = 0; i < len; i++) {
                    args[i] = iters[i].nextByte();
                }

                return zipFunction.apply(args);
            }
        }).onClose(newCloseHandler(c));
    }
658919
public static <A, B, C, R> Stream<R> zip(final Collection<? extends A> a, final Collection<? extends B> b, final Collection<? extends C> c,
            final TriFunction<? super A, ? super B, ? super C, R> zipFunction) {
        return zip(a.iterator(), b.iterator(), c.iterator(), zipFunction);
    }
210980
public static <R> Stream<R> zip(final ShortStream a, final ShortStream b, final ShortBiFunction<R> zipFunction) {
        return zip(a.iteratorEx(), b.iteratorEx(), zipFunction).onClose(newCloseHandler(N.asList(a, b)));
    }
1048709
public static <R> Stream<R> zip(final DoubleIterator a, final DoubleIterator b, final DoubleBiFunction<R> zipFunction) {
        return new IteratorStream<>(new ObjIteratorEx<R>() {
            @Override
            public boolean hasNext() {
                return a.hasNext() && b.hasNext();
            }

            @Override
            public R next() {
                return zipFunction.apply(a.nextDouble(), b.nextDouble());
            }
        });
    }