Java ArrayList Max maxEltsInOneSetOfValues(ArrayList values)

Here you can find the source of maxEltsInOneSetOfValues(ArrayList values)

Description

The maxEltsInOneSetOfValues method takes in values for the attributes and returns the max number of elements in one set of values

License

Open Source License

Parameter

Parameter Description
values an <code>ArrayList</code> of <code>ArrayList</code>s of values

Return

an int corresponding to the max number of elements in one set of values

Declaration

public static int maxEltsInOneSetOfValues(ArrayList values) 

Method Source Code


//package com.java2s;
/* This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 *//*from  ww  w .  j  a  va2 s  .c o  m*/

import java.util.ArrayList;

public class Main {
    /**
     * The <code>maxEltsInOneSetOfValues</code> method takes in values for the attributes
     * and returns the max number of elements in one set of values
     *
     * @param values an <code>ArrayList</code> of <code>ArrayList</code>s of values
     * @return an <code>int</code> corresponding to the max number of elements in one set of values
     */
    public static int maxEltsInOneSetOfValues(ArrayList values) {
        int max = 0;
        ArrayList oneSetOfValues = null;
        for (int i = 0; i < values.size(); i++) {
            oneSetOfValues = (ArrayList) values.get(i);
            if (oneSetOfValues.size() > max) {
                max = oneSetOfValues.size();
            }
        }
        return max;
    }
}

Related

  1. getMaxOfArrayListInteger(List integerList)
  2. getMaxString(ArrayList labels, int currindx)
  3. getMaxValue(ArrayList values)
  4. Max(ArrayList> data)
  5. Max(ArrayList values)
  6. maxInColumns(ArrayList lines)
  7. maxIntValue(ArrayList ints)
  8. maxLength(ArrayList> a)
  9. maxLengthSurface(ArrayList value)