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

mac2022-06-30  23

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())); }

 

转载于:https://www.cnblogs.com/R4mble/p/8407908.html

最新回复(0)