How can I convert Stream<int[]>
into int[]
without using forEach
?
final Stream<int[]> stream = foos.stream()
.map(foos -> insertQuery(contact, create))
.map(create::batch)
.map(Batch::execute); //Batch::execute will return the int[]
Use flatMapToInt
int[] result = stream.flatMapToInt(Arrays::stream).toArray();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With