Java Collection Max max(Collection data)

Here you can find the source of max(Collection data)

Description

max

License

Open Source License

Parameter

Parameter Description
data a parameter

Return

the max

Declaration

public static Double max(Collection<Double> data) 

Method Source Code

//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;
    }
}

Related

  1. calculateMaxTime(Collection times)
  2. format(String theLabel, Collection coll, int maxNumberReported, String theClassName)
  3. getMaximumElementLength(final Collection collection)
  4. max(Collection coll)
  5. max(Collection doubles)
  6. max(Collection values)
  7. max(Collection collection)
  8. max(Collection list)