Here you can find the source of maxLength(ArrayList
Parameter | Description |
---|---|
a | the array of arrays to find the length of. |
public static int maxLength(ArrayList<ArrayList<Integer>> a)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.Collection; public class Main { /**//from ww w.j a v a 2 s. co m * Find the maximum length of any given element in the array. * * @param a * the array of arrays to find the length of. * @return the largest length of any array in the list. */ public static int maxLength(ArrayList<ArrayList<Integer>> a) { int i = 0; for (ArrayList<Integer> e : a) i = Math.max(i, e.size()); return i; } public static int Max(Collection<Integer> a) { int i = 0; for (int z : a) i = Math.max(i, z); return i; } public static int Max(ArrayList<ArrayList<Integer>> data) { int c = 0; for (int i = 0; i < data.size(); i++) c = Math.max(c, Max(data.get(i))); return c; } }