I need to get the length of a 2D array for both the row and column. I’ve successfully done this, using the following code:
public class MyClass { public s
With Java 8, allow you doing something more elegant like this:
Java 8
int[][] foo = new int[][] { new int[] { 1, 2, 3 }, new int[] { 1, 2, 3, 4}, }; int length = Arrays.stream(array).max(Comparator.comparingInt(ArrayUtils::getLength)).get().length