How to convert List of arrays into a single array in Java. Is there any predefined function to use?
Below is the list of arrays, I want to iterate and keep all values in a single array.
List<Integer[]> integerArrayList = new ArrayList<Integer[]>();
Integer[] resultArray = {};
Is there efficient way to implement?
Java 8's stream make this pretty easy:
Integer[] resultArray = 
    integerArrayList.stream().flatMap(Arrays::stream).toArray(Integer[]::new);
                        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