如何转换Stream< int []>进入int []而不使用forEach?
final Stream<int[]> stream = foos.stream() .map(foos -> insertQuery(contact,create)) .map(create::batch) .map(Batch::execute); //Batch::execute will return the int[]
解决方法
使用
flatMapToInt
int[] result = stream.flatMapToInt(Arrays::stream).toArray();