Here you can find the source of getMaxOf(final List
Parameter | Description |
---|---|
list | a parameter |
public static int getMaxOf(final List<Integer> list)
//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; } }