Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/366.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Java 8中,如何从流中获取int数组<;int[]>;不使用forEach_Java_Java 8_Java Stream - Fatal编程技术网

在Java 8中,如何从流中获取int数组<;int[]>;不使用forEach

在Java 8中,如何从流中获取int数组<;int[]>;不使用forEach,java,java-8,java-stream,Java,Java 8,Java Stream,如果不使用forEach,如何将Stream转换为int[] final Stream<int[]> stream = foos.stream() .map(foos -> insertQuery(contact, create)) .map(create::batch) .map(Batch::execute); //Batch::execute will return the int[] final

如果不使用
forEach
,如何将
Stream
转换为
int[]

final Stream<int[]> stream = foos.stream()
            .map(foos -> insertQuery(contact, create))
            .map(create::batch)
            .map(Batch::execute); //Batch::execute will return the int[]
final Stream=foos.Stream()
.map(foos->insertQuery(联系人,创建))
.map(创建::批处理)
.map(批处理::执行)//Batch::execute将返回int[]
使用

int[] result = stream.flatMapToInt(Arrays::stream).toArray();