154k views
11 votes
How do you flatten a 2D array to become a 1D array in Java?

User Oscarina
by
5.1k points

1 Answer

5 votes

Answer:

With Guava, you can use either

int[] all = Ints.concat(originalArray);

or

int[] all = Ints.concat(a, b, c);

Step-by-step explanation:

Use GUAVA

User Gobliins
by
4.5k points