Java List Max getMaxOf(final List list)

Here you can find the source of getMaxOf(final List list)

Description

Useful function that return the maximum of an integer list

License

Open Source License

Parameter

Parameter Description
list a parameter

Return

The max of all integer in list

Declaration

public static int getMaxOf(final List<Integer> list) 

Method Source Code


//package com.java2s;
/*/*from w  w  w  . ja v  a 2s.  c  om*/
 * This file is part of the GWTUML project and was written by Mounier Florian <mounier-dot-florian.at.gmail'dot'com> for Objet Direct
 * <http://wwww.objetdirect.com>
 * 
 * Copyright ? 2009 Objet Direct Contact: gwtuml@googlegroups.com
 * 
 * GWTUML is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later version.
 * 
 * GWTUML 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 Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License along with GWTUML. If not, see <http://www.gnu.org/licenses/>.
 */

import java.util.List;

public class Main {
    /**
     * Useful function that return the maximum of an integer list
     * 
     * @param list
     * @return The max of all integer in list
     */
    public static int getMaxOf(final List<Integer> list) {
        int max = 0;
        for (final int i : list) {
            max = i > max ? i : max;
        }
        return max;
    }
}

Related

  1. getMaxId(List ids)
  2. getMaximums(List data)
  3. getMaxLength(List values)
  4. getMaxLineWidth(final List str)
  5. getMaxListStringFromList(List days)
  6. getMaxOfAList(List list)
  7. getMaxSize(final List list)
  8. getMaxStrWidth(List list)
  9. getMaxValIndex(List vals)