Here you can find the source of max(Collection
Parameter | Description |
---|---|
data | a parameter |
public static Double max(Collection<Double> data)
//package com.java2s; /******************************************************************************* * Copyright (c) 2009, 2013, 2014 Matthew Purver, Queen Mary University of London. * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU Public License v3.0 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/gpl.html/* w ww . j a v a2 s . com*/ ******************************************************************************/ import java.util.Collection; import java.util.Collections; public class Main { /** * @param data * @return the max */ public static Double max(Collection<Double> data) { return Collections.max(data); } /** * @param data * @return the max */ public static double max(double[] data) { double max = Double.NEGATIVE_INFINITY; for (double datum : data) { max = Math.max(max, datum); } return max; } }