我需要String在Java中连接两个数组.
void f(String[] first, String[] second) {
String[] both = ???
}
Run Code Online (Sandbox Code Playgroud)
最简单的方法是什么?
本页展示了如何将两个Integer对象数组组合成一个Object对象数组。
Integer[] firstArray = new Integer[] { 10 , 20 , 30 , 40 };
Integer[] secondArray = new Integer[] { 50 , 60 , 70 , 80 };
Object[] merged =
Stream
.of( firstArray , secondArray )
.flatMap( Stream :: of )
.toArray()
;
Run Code Online (Sandbox Code Playgroud)
Arrays.toString( 合并): [10, 20, 30, 40, 50, 60, 70, 80]
? 有没有办法使用 Java 流来连接一对原始int值数组而不是对象?
int[] a = { 10 , 20 , 30 , 40 };
int[] b …Run Code Online (Sandbox Code Playgroud)