38,869 views
4 votes
4 votes
How do you flatten a 2D array to become a 1D array in Java?

User Abhranil Das
by
2.6k points

1 Answer

17 votes
17 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 Mick Cullen
by
2.8k points