(二)连接两个数组返回新数组

public static <T> T[] concat(T[] first, T[] second) {
    return Stream.concat(
            Stream.of(first),
            Stream.of(second)
    ).toArray(i -> (T[]) Arrays.copyOf(new Object[0], i, first.getClass()));
}

 

posted @ 2018-02-03 01:09  R4mble  阅读(155)  评论(0编辑  收藏  举报