I would like to know how to convert a 2 dimensional array into a 1 dimensional array. I have come up with some code but it doesn\'t exactly seem to work. Can someone please
Flatten did become much easier in Java 8 with the stream API. The function can be expressed as:
private static String[] flatten(String[][] data) { return Stream.of(data).flatMap(Stream::of).toArray(String[]::new); }